Gradle project sync fail, no toolchains

2020-04-06 03:20发布

Hello I'm getting this error in android studio :

Gradle project sync failed. Basic functionality (editing, debugging) will not work properly

And in messages I get this :

Gradle sync failed: No toolchains found in the NDK toolchains folder for ABI with prefix: arm-linux-androideabi

I've searched for a solution, but I haven't found one.

Hopefully someone from here can help me.

5条回答
干净又极端
2楼-- · 2020-04-06 03:34

enter image description here First

open build.gradle(module:app) app file and make following changes in it.

  • replace compile(if present) with api wherever api ref. like: volley, GitHub dependancy.strong text is used and
  • replace compile (if present) with implementation incase of using android libraries like play-services-maps,appcompat-v7 etc.

example: old way

  dependencies {
     testCompile'junit:junit:4.12'
    compile 'com.android.volley:volley:1.1.0' 

Change it to:

 dependencies {
    testImplementation 'junit:junit:4.12'
    implementation 'com.android.volley:volley:1.1.0'

Then,

open build.gradle (Project: yourproject) file * and change the google gms services to the latest

dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'


        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }

Then,

  • Open gradle-wrapper.properties file and replace it with following:
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

Perform gradle sync and then Rebuild the project.

查看更多
对你真心纯属浪费
3楼-- · 2020-04-06 03:35

As MustafaKemal, I canceled an NDK update, and after that I got the Gradle sync error message.

What solved my problem: on Android Studio go to Tools -> Android -> SDK manager -> SDK Tool and uncheck the Android NDK checkbox, then Apply.

After that, open the item again and check it and apply to reinstall it.

then be patient, it might seem the installation is stuck whilst unzipping a file but after a while, a long while, it finishes.

查看更多
▲ chillily
4楼-- · 2020-04-06 03:37

Your Android Studio does not include NDK. You can fix this problem.

Android Studio -> Tools -> Android -> SDK manager -> SDK Tool

You must install NDK here.

查看更多
我命由我不由天
5楼-- · 2020-04-06 03:45

According the GitHub post, your Android Gradle plugin is looking for mips toolchain which may not exist. Solution is to update the Android Gradle plugin and Gradle version.

Update Android Gradle plugin version in the app level build.gradle file.

buildscript {
...
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.4'
        ...
    }
}

Android Gradle plugin will also require Gradle version 4.4 which you may update in gradle-wrapper.properties.

distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
查看更多
啃猪蹄的小仙女
6楼-- · 2020-04-06 03:45

I had the same problem, because I canceled the NDK update, while unzipping because it took to much time... I solved the problem by deleting NDK - bundle folder under /Users/..../Library/Android/sdk and re-install it. But it took almost 3-4 hours :(

查看更多
登录 后发表回答