Gradle cannot find a toolchain in the NDK toolchains folder
No toolchains found in the NDK toolchains folder for ABI with prefixShort answer
Newer NDKs moved the toolchain to toolchains/llvm/prebuilt, and old Android Gradle plugin versions still look in the old folders. Upgrade the plugin, and pin one NDK version with ndkVersion so Gradle does not pick up a stale install or an old ndk.dir path.
Fix it fast
1Find out which cause you have
List the NDK versions installed side by side, and check which Android Gradle plugin version the project uses.
ls $ANDROID_HOME/ndk grep -rn "com.android" build.gradle* settings.gradle* gradle/libs.versions.toml 2>/dev/null2Match what you see, then jump to its fix
- 1
The error appears after installing or updating the NDKThe Android Gradle plugin is too old for the NDKFix - 2
The build picks an NDK you did not expect, or a path from an old local.propertiesA stale or wrong NDK is selectedFix - 3
ndkVersion is set but ls shows no folder with that nameThe pinned NDK is not installedFix
- 1
What does the error look like?
No toolchains found in the NDK toolchains folder for ABI with prefix
Cause 1 of 3
The Android Gradle plugin is too old for the NDK
1Check
The NDK changelog says r19 is incompatible with Android Gradle plugin 3.0 or older, because the toolchain layout changed. A very old plugin in a legacy project is the usual trigger.
grep -rn "com.android.tools.build:gradle\|com.android.application" . --include=*.gradle --include=*.kts --include=*.toml2Fix
Upgrade the Android Gradle plugin, with a matching Gradle version and Android Studio. Do not go below plugin 3.1.
// settings.gradle.kts
plugins {
id("com.android.application") version "8.7.3" apply false
}3Verify
Sync the project and run the native build.
./gradlew assembleDebugConfirmed by github.com
Cause 2 of 3
A stale or wrong NDK is selected
1Check
ndk.dir in local.properties is deprecated. If several NDKs are installed, Gradle needs to know which one to use.
grep -n "ndk" local.properties
ls $ANDROID_HOME/ndk2Fix
Remove ndk.dir from local.properties and pin the version in the module's build file. If you do not set a version, the Android Gradle plugin chooses one it is known to be compatible with.
android {
ndkVersion = "28.2.13676358"
}3Verify
Sync and build again; the native build now finds its toolchain.
./gradlew assembleDebugConfirmed by developer.android.com
Cause 3 of 3
The pinned NDK is not installed
1Check
NDK versions install side by side under the SDK's ndk directory.
ls $ANDROID_HOME/ndk2Fix
Install that version: in Android Studio, Tools, SDK Manager, SDK Tools, tick Show Package Details and the NDK (Side by side) version.
# Tools > SDK Manager > SDK Tools > Show Package Details > NDK (Side by side) > choose version > OK3Verify
The version folder now exists.
ls $ANDROID_HOME/ndkConfirmed by developer.android.com
How do I stop it coming back?
- Always set ndkVersion in modules that build native code.
- Keep the Android Gradle plugin current; each version is tested against a specific NDK.
- Keep ndk.dir out of local.properties.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
Related fixes
Mobile apps
Flutter Android: plugins need a different NDK than the project uses
- some_plugin requires Android NDK 28.2.13676358
Flutter's Gradle check compares the NDK your app uses with the NDK each plugin requires.
2 causes, each with a fixMobile apps
adb cannot start because something already holds its port
adb start-server failed
The adb server must bind local TCP port 5037, and every adb client talks to it there.
2 causes, each with a fixMobile apps
The phone shows as unauthorized and Android Studio will not run the app
adb devices lists the phone but Android Studio cannot deploy to it
An unauthorized phone means it has not trusted this computer's RSA key.
3 causes, each with a fixMobile apps
Android Studio cannot pair the phone over Wi-Fi
The Pair devices over Wi-Fi dialog lists no device
Wireless pairing needs the phone on Android 11 or higher and on the same Wi-Fi network as the computer, with current Platform-Tools.
4 causes, each with a fixMobile apps
adb cannot connect to its daemon or start the server
* daemon started successfully *
The adb server is a background process on your computer that listens on TCP port 5037.
2 causes, each with a fixMobile apps
adb prints 'server version doesn't match this client; killing...'
adb server version doesn't match this client; killing...
adb runs a background server, and every adb command is a client.
3 causes, each with a fix