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.
Two years has passed, now if you come across here, you may possibly encounterd error message like this:
No toolchains found in the NDK toolchains folder for ABI with prefix mips64el-linux-android
or
No toolchains found in the NDK toolchains folder for ABI with prefix mipsel-linux-android
Latest NDK removed support for mips
abi, and earler version of android gradle plugin still check for the existance of mips toolchain. see here for more info.
Solution: Upgrade android gradle plugin to 3.1 or newer.
e.g. Add following in the project level gradle [28-Sept-2018]
classpath "com.android.tools.build:gradle:3.2.0"
Workaround: Create mipsel-linux-android
folder structure to fool the tool. The easiest way would be to symbolic link to aarch64-linux-android-4.9
.
# on Mac
cd ~/Library/Android/sdk/ndk-bundle/toolchains
ln -s aarch64-linux-android-4.9 mips64el-linux-android
ln -s arm-linux-androideabi-4.9 mipsel-linux-android
Check this thread of three options for solving this kind of issue
I fixed this Error by uninstalling the NDK in the SDK-Tools. So, if you don't need the NDK, uninstall it.
For Android studio 3.2.1+
Upgrade your Gradle Plugin
classpath 'com.android.tools.build:gradle:3.2.1'
If you are now getting this error:
Could not find com.android.tools.build:gradle:3.2.1.
just add google()
to your repositories, like this:
repositories {
google()
jcenter()
}
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.
Download the android NDK for windows from https://developer.android.com/ndk/downloads/index.html. Extract the same and copy the "toolchain" folder from the bundle. Paste the folder under installed NDK folder under C:\android-sdk-win\ndk-bundle.[Installed the path may vary based on your installation] 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.
Error : Android MIPS ToolChain directory "" does not exist
" in Game Maker Studio 2 on a Mac. But I needed to get version 17c of the NDK from here : developer.android.com/ndk/downloads/older_releases (as per: reddit.com/r/gamemaker/comments/9m958a/…) Thank You @nithinjith ! ... still not building however, need to solve : Android NDK: Please fix the APP_ABI definition in /Users/../Library/Android/sdk/ndk-bundle/build/core/default-application.mk
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 macOS 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
Step-by-step:
1) Open the page with old NDK versions:
https://developer.android.com/ndk/downloads/older_releases
https://i.stack.imgur.com/gCmB0.png
2) Agree the Terms:
https://i.stack.imgur.com/z63Ft.png
3) Download the older version of NDK
(for example 16b):
https://i.stack.imgur.com/Wqj1A.png
4) Open your toolchains
directory.
5) Transfer files that you need from toolchains
folder of downloaded zip-file to your toolchains
folder:
https://i.stack.imgur.com/rS3aO.png
6) Rebuild the Project:
https://i.stack.imgur.com/qCHSD.png
UPD 30 Sep 2018: I used Android NDK Revision r16b for fix this error in my own case. So I present the example with this version. But it's better to use the Android NDK, Revision r17c (June 2018). It is the last one, supporting mips (reasonable reccomendation from Weekend's comment).
(for example 16b)
, it's better to clarify which NDK version is the last one supporting mips. via release note of Android NDK Revision r17c (June 2018): Support for ARMv5 (armeabi), MIPS, and MIPS64 has been removed. Attempting to build any of these ABIs will result in an error. It's 16b
exactly.
16b
exactly. r17c is the first version which removed the support for MIPS :)
Without downloading, copying, or symlinking anything, I was able to "fix" the error by simply creating an empty directory where the older version of the Android Gradle plugin expects the removed mips toolchain:
mkdir -p $ANDROID_HOME/ndk-bundle/toolchains/mips64el-linux-android/prebuilt/linux-x86_64
Obviously, $ANDROID_HOME
points to the root of the Android SDK installation here. If you are using MacOS, replace linux-x86_64
with darwin-x86_64
in the command above. On Windows use windows-x86_64
.
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 .
The best solution for this problem is:
Go to SDK Manager. Next choose SDK tools. Unselect NDK (side by side). Apply and OK.
In my case, this error occured when creating a new Android Studio (Android studio 3.2.1) Java Project with
classpath 'com.android.tools.build:gradle:2.0.0-beta6'
So I´ve downgraded to
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
}
Not the best solution stay at an older version, but maybe it´s just a temporary bug in the beta as the NDK path in local.properties is still the same, but the IDE doesn´t complain anymore
Android NDK 18.0* seems has an issue not creating all the files in folders after extraction. Due to it, your app compilation will fail which uses ndk builds.
Better is to use NDK 17.1* (https://developer.android.com/ndk/downloads/) etc version and you can extract or use the android studio extraction to ndk-bundle by default will work good.
Open Android Studio, Go to Tools then Android and then SDK, uncheck NDK If you do not need this, and restart android studio.
[https://github.com/tensorflow/tensorflow/tree/master/tensorflow/examples/android][1]
For people trying out this example and facing issues with latest NDK. Can follow this solution. In build.gradle change this
classpath 'com.android.tools.build:gradle:3.0.1'
To
classpath 'com.android.tools.build:gradle:3.1.2'
The reason is mips are deprecated in the latest ndk versions, Gradle version 3.1.2 will not have a compulsion for mips. It assumes the presence for these missing folders.
The simple solution is download and extract the following file which contains mips64el-linux-android-4.9 and mipsel-linux-android-4.9 folders,to your toolchains folder inside sdk "android-sdk\ndk-bundle\toolchains".
Downlod this file and extraxt to toolchains foolder
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://i.stack.imgur.com/ftk7t.png
When compiling a project in android studio, I occasionally encounter:
Error: No toolchains found in the NDK toolchains folder for ABI with prefix: arm-linux-androideabi/llvm
This may be caused by updating related components. The solution is to Android studio ( Tools -> Android -> SDK Manager ) . Select the ndk item and delete it. If the program needs it, you can re-install it. This will ensure that the folder location is correct and there will be no such problem.
To resolve the issue just go to:
https://i.stack.imgur.com/loLxy.png
I resolved the same issue in linux(Ubuntu) machine using this technique.
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:
Install the newest NDK using sdk manager 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 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.
In your project level Gradle file increase the dependencies classpath version low to high like
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
}
to change like
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
}
Solved it by adding google()
dependency into both repositories in build.gradle
(Project: ProjectName). then sync your project
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
I solved this question by unInstalled ndk, becasuse I dont't need it
I navigated to local.properties, and in there the
ndk.dir=/yo/path/for/NDK
line needs to be updated to where your ndk lies.
I was using Crystax NDK, and didn't realize the original Android NDK was still in use.
To fix it like i did
Android Studio File> project structure and go to project
change Gradle version to 4.6 & Android plugin version to 3.2.1
then clean project if you got this Error "Could not find aapt2-proto.jar"
go to build.gradle (project)
Try moving the google() method (.gradle file) to the top of its execution block the order of repositories it searches in that causes the issue.
for example, change this:
repositories {
maven { url 'https://maven.fabric.io/public' }
google() <=== from here
mavenCentral()
}
To this:
repositories {
google() <=== to here
maven { url 'https://maven.fabric.io/public' }
mavenCentral()
}
Make those changes in both "buildscript" and "allprojects "
If you didn't find google() add it
For Android Studio 3.2.1 Update your
Gradle Version 4.6
Android plugin version 3.2.1
NOTE: This answer seems to be specific to: No toolchains found in the NDK toolchains folder for ABI with prefix: mips64el-linux-android
, but it was linked here by:
From NDK r19b:
more ~/Android/Sdk/ndk-bundle/CHANGELOG.md
This version of the NDK is incompatible with the Android Gradle plugin version 3.0 or older. If you see an error like No toolchains found in the NDK toolchains folder for ABI with prefix: mips64el-linux-android, update your project file to [use plugin version 3.1 or newer]. You will also need to upgrade to Android Studio 3.1 or newer.
Navigate to C:\Users\lalit\AppData\Local\Android\Sdk\ndk-bundle\toolchains
.
Now, find the folder name aarch64-linux-android-4.9
and rename it to mips64el-linux-android
.
Re-run the android app.
Find your own local android-SDK, if you download the relevant SDK of ndk, there will be a folder called "ndk-bundle"
https://i.stack.imgur.com/v2uWJ.png
There is a folder called "toolchains" inside.
https://i.stack.imgur.com/NRfZv.png
We noticed that there are no mips64el related files inside.
https://i.stack.imgur.com/PqKuo.png
The solution is as follows:
Click here to download the NDK package separately through the browser. After unzipping, open the "toolchains" folder, compare it with the android-sdk->ndk-bundle->toolchains folder, find the missing folder, copy the past three. Recompile, the problem is solved.
Delete all your NDK in sdk tools.
The issue comes mostly when you are cloning a previous project specially from github. What you can do is
Change the classpath to
classpath 'com.android.tools.build:gradle:3.2.1'
in your project level gradle.
Then Change all the instances of compile with implementation except compileSdkVersion keep it as it is in your app level gradle. Instead of sync now click on make project(Ctrl+F9) Add google maven repositories if needed. Upgrade the gradle wrapper if needed.
(Android Studio IDE will ask / guide you with the same for steps 4 and 5)
Success story sharing
build.gradle
file, something likecom.android.tools.build:gradle:3.2.0-rc02
, not Gradle version# on Mac cd ~/Library/Android/sdk/ndk-bundle/toolchains ln -s aarch64-linux-android-4.9 mips64el-linux-android ln -s arm-linux-androideabi-4.9 mipsel-linux-android
mklink /d mips64el-linux-android aarch64-linux-android-4.9
andmklink /d mipsel-linux-android arm-linux-androideabi-4.9
worked for me too.