Error: No toolchains found in the NDK toolchains folder for ABI with prefix: llvm

匿名 (未验证) 提交于 2019-12-03 01:49:02

问题:

I want to compile an open source android project (Netguard) using gradel (gradlew clean build) But I encountered this Error:

A problem occurred configuring project ':app'. > Exception thrown while executing model rule: NdkComponentModelPlugin.Rules#cre ateToolchains    > No toolchains found in the NDK toolchains folder for ABI with prefix: llvm 

I serached but didn't find enything helping. Here is the main build.gradle:

buildscript {     repositories {         jcenter()     }     dependencies {         classpath 'com.android.tools.build:gradle-experimental:0.6.0-alpha1'     } } allprojects {     repositories {         jcenter()     } } task clean(type: Delete) {     delete rootProject.buildDir } 

And here is the build.gradle of the app project:

apply plugin: 'com.android.model.application'  model {     android {         compileSdkVersion = 23         buildToolsVersion = "23.0.2"          defaultConfig.with {             applicationId = "eu.faircode.netguard"             minSdkVersion.apiLevel = 21             targetSdkVersion.apiLevel = 23             versionCode = 2016011801             versionName = "0.76"             archivesBaseName = "NetGuard-v$versionName-$versionCode"         }     }     android.ndk {         moduleName = "netguard"         toolchain = "clang"         ldLibs.add("log")     }     android.sources {         main {             jni {                 source {                     srcDir "src/main/jni/netguard"                 }                 exportedHeaders {                 }             }         }     }     android.buildTypes {         release {             minifyEnabled = true             proguardFiles.add(file('proguard-rules.pro'))             ndk.with {                 debuggable = true             }         }     }     android.buildTypes {         debug {             ndk.with {                 debuggable = true             }         }     }     android.productFlavors {         create("all") {         }     } }  dependencies {   compile fileTree(dir: 'libs', include: ['*.jar'])     compile 'com.android.support:appcompat-v7:23.1.+'     compile 'com.android.support:recyclerview-v7:23.1.+'     compile 'com.squareup.picasso:picasso:2.5.+' } 

And I'm using gradle-2.9-all and android-ndk-r10e. I don't know if I should mention anything else, so comment if you need any information.

回答1:

Error message: “No toolchains found in the NDK toolchains folder for ABI with prefix: llvm” .

After fresh web installation of Android Studio with NDK, I imported an Android code sample that used NDK from GitHub and tried to compile it.

As a result had an Error:

No toolchains found in the NDK toolchains folder for ABI with prefix: llvm

Solution: for some reasons standard installation process on the MAC had failed to install a complete set:

~/Library/Android/sdk/ndk-bundle had missed folder toolchains with all tools,

(it should be like this: ~/Library/Android/sdk/ndk-bundle/toolchains)

The solution was to download NDK separately, open it, copy folder toolchain and paste it to the folder:

~/Library/Android/sdk/ndk-bundle 

After that it worked well for me.



回答2:

I have faced the same problem while update Android studio from 2.0 to 2.1 in my Windows 8 machine.

I found a solution for that.Please use the following steps.

  1. Download the android NDK for windows from https://developer.android.com/ndk/downloads/index.html.
  2. Extract the same and copy the "toolchain" folder from the bundle.
  3. Paste the folder under installed NDK folder under C:\android-sdk-win\ndk-bundle.[Installed the path may vary based on your installation]
  4. Restart android studio.

This is happening because Android studio won't gets full NDK update in the stable channel. If you are not using NDK for your project development you can simply remove the NDK folder from your SDK directory.



回答3:

I fixed this Error with uninstalling the NDK in the SDK-Tools. So if you don't need the NDK, uninstall it.

greez h



回答4:

In my case, this error occured when creating a new Android Studio Java Project with

    classpath 'com.android.tools.build:gradle:2.0.0-beta6' 

    classpath 'com.android.tools.build:gradle:1.2.3' 

local.properties



回答5:

I uninstalled the NDK since I didn't need it . Go to SDK manager on Android studio ( Tools -> Android -> SDK Manager ) . If NDK is installed . Just uncheck the box and click OK . The installed components will be deleted .



回答6:

I've had a similar problem, but I wanted to use NDK version r9d due to project requirements.

In local.properties the path was set to ndk.dir=C\:\\Android\\ndk\\android-ndk-r9d but that lead to the problem:

No toolchains found in the NDK toolchains folder for ABI with prefix: [toolchain-name]

The solution was to:

  1. Install the newest NDK using sdk manager
  2. Copy the missing toolchain [toolchain-name] from the new ndk to the old. In my case from sdk\ndk-bundle\toolchains to \ndk\android-ndk-r9d\toolchains
  3. Repeat the process till all the required toolchains are there

It looks to me that the copied toolchains are not used, but for some reason it is needed to for them be there.



回答7:

For me I think there might be some issue in installing android NDK from android studio. I was able to resolve this in following manner

Downloaded android ndk from

https://developer.android.com/ndk/downloads/index.html

and placed inside ndk-bundle (where your android sdk is installed ). For more info check this screens.

https://developer.android.com/ndk/downloads/index.html



回答8:

If you don't use the NDK, unset the environment variable ANDROID_NDK_HOME.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!