Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Flutter and app store releases

Gradle cannot find a toolchain in the NDK toolchains folder

ErrorNo toolchains found in the NDK toolchains folder for ABI with prefix

Short 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.

  • Applies to Android Gradle Plugin 8, NDK r26 to r28, Android Studio
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 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/null
  2. 2Match what you see, then jump to its fix

    1. 1The error appears after installing or updating the NDKThe Android Gradle plugin is too old for the NDKFix
    2. 2The build picks an NDK you did not expect, or a path from an old local.propertiesA stale or wrong NDK is selectedFix
    3. 3ndkVersion is set but ls shows no folder with that nameThe pinned NDK is not installedFix

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=*.toml

2Fix

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 assembleDebug

Confirmed by github.com

Did this fix it?

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/ndk

2Fix

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 assembleDebug

Confirmed by developer.android.com

Did this fix it?

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/ndk

2Fix

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 > OK

3Verify

The version folder now exists.

ls $ANDROID_HOME/ndk

Confirmed by developer.android.com

Did this fix it?

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

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 fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.