No toolchains found in the NDK toolchains folder f

2019-03-18 23:32发布

问题:

This question already has an answer here:

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

Can anyone tell me why I am receiving this error? I have downloaded a series of projects from GitHub for a Udacity course. Since there are about 50 or 60 projects (Exercises and Solutions) in the repo, I presume it has to do with the fact that each is an individual project on its own. I do not have a problem usually when I fork a repo and clone it locally.

I have read other posts about uninstalling and reinstalling ndk in the sdk. But I really want to know why this is happening and how I can fix without blindly uninstalling and re-installing. Any help is appreciated. Thanks.

回答1:

If you are using NDK >= 18 you have to update your android gradle plugin to >=3.1.x

See the Known Issues section:

https://android.googlesource.com/platform/ndk/+/ndk-release-r18/CHANGELOG.md



回答2:

Ok after looking around the solution was to remove the NDK designation from my preferences.

Android Studio -> Preferences -> System Settings -> Android SDK -> SDK Tools -> Unselect NDK -> Apply button.

Project and Gradle compiled fine after that and I was able to move on with my project work.

As far as why this is happening, I do not know but for more info on NDK check out: https://developer.android.com/ndk/

I will go back and enable these libraries but for now, I am just glad I can move on with my work. :)



回答3:

for me, upgrade the Android Gradle plugin version to 3.2+ works.

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


回答4:

Android Studio -> Preferences -> System Settings -> Android SDK -> SDK Tools -> Unselect NDK -> Apply button.

It works fine for me.



回答5:

Updating the Android Gradle plugin is definitely the preferred solution. However, if for whatever reason you can't do that, it's easy to simply "fix" the error without downloading, copying, or symlinking anything, by just creating an empty directory:

mkdir -p $ANDROID_HOME/ndk-bundle/toolchains/mips64el-linux-android/prebuilt/linux-x86_64

$ANDROID_HOME points to the root of the Android SDK installation. On MacOS, replace linux-x86_64 with darwin-x86_64. Use windows-x86_64 on Windows.



回答6:

If you don't want to update your gradle plugin you can do this. Download one of the older NDK releases, e.g. r17c. Open downloaded NDK archive, go to toolchains directory and copy missing toolchain folders to toolchains folder of your currently used NDK. In my case the folders I had to copy were mipsel-linux-android-4.9 and mips64el-linux-android-4.9.



回答7:

It's Because of NDK Version You are selected Follow the steps which will help you to resolve

If you want to use NDK then Update the Gradle Plugin

In build script change Dependecies

classpath { 'com.android.tools.build:gradle:3.2.1'
classpath {'com.google.gms:google-services:3.2.0'}

if you are unaware of the NDK then simply disable it by selecting preferences>System settings>android sdk>Select SDK Tools > uncheck NDK there

Rebuild the project it works just fine

Happy Coding <3