Programming

No version of NDK matched the requested version

19 September 2026 · 10 min read

No version of NDK matched the requested version

Encountering the frustrating error message “No version of NDK matched the requested version” in your Android development journey is a common hurdle, especially when working with native code. This error typically arises when the Android Gradle Plugin (AGP) in your project can’t find a compatible version of the Native Development Kit (NDK). It can halt your build process and leave you scratching your head, unsure of how to proceed. This guide will break down the causes of this error, provide step-by-step solutions, and equip you with the knowledge to prevent it from recurring. Understanding the intricacies of NDK versions, Gradle configurations, and project settings is crucial for smooth Android development. We’ll explore various scenarios and solutions to get your project back on track and compiling successfully. Let’s dive in and resolve this NDK version mismatch issue together, ensuring your Android development experience is as seamless as possible.

Understanding the NDK and Its Importance

The Android NDK (Native Development Kit) is a set of tools that allows you to implement parts of your app in native code, using languages such as C and C++. This is particularly useful for performance-intensive tasks like game development, signal processing, or when reusing existing C/C++ libraries. The NDK provides headers, libraries, and build tools necessary to compile native code into shared libraries that can be linked with your Android application. Proper configuration of the NDK is essential for apps that rely on native components.

Different versions of the Android Gradle Plugin (AGP) require specific NDK versions. Compatibility issues arise when the AGP expects a particular NDK version that is either not installed or not correctly configured in your Android Studio project. For instance, AGP 7.0 might require NDK 21 or higher, while an older AGP version might be compatible with NDK 19 or 20. Failing to adhere to these version constraints can lead to the “No version of NDK matched the requested version” error. The official Android documentation ([https://developer.android.com/ndk](https://developer.android.com/ndk)) provides detailed compatibility matrices.

The NDK’s role extends beyond just performance; it also allows developers to access platform-specific APIs and features that might not be directly available through the Java/Kotlin layer. By leveraging native code, developers can optimize their apps for specific hardware architectures, potentially leading to improved battery life and overall performance. However, this power comes with the responsibility of managing NDK versions and ensuring compatibility across different Android devices. According to Google’s Android Developers Blog, optimizing native code can improve app performance by up to 30% in certain scenarios ([https://android-developers.googleblog.com/](https://android-developers.googleblog.com/)).

Common Causes of the NDK Version Mismatch Error

Several factors can contribute to the “No version of NDK matched the requested version” error. Identifying the root cause is the first step towards resolving the issue. Let’s explore some of the most common culprits.

Incorrect NDK Configuration in build.gradle: The build.gradle file (both project-level and module-level) contains configurations related to the NDK. If the ndkVersion property is explicitly set to a version that is not installed or incompatible with your AGP, you’ll encounter the error. For example, specifying ndkVersion “25.0.8775105” when you only have NDK 21 installed will trigger the error. It’s crucial to either specify a valid version or let Gradle manage the NDK version automatically.

Missing or Corrupted NDK Installation: Sometimes, the NDK might not be installed at all, or the installation might be corrupted. This can happen due to incomplete downloads, interrupted installations, or issues with Android Studio’s SDK manager. Ensure that the required NDK version is properly installed through the SDK Manager. Navigate to Android Studio > SDK Manager > SDK Tools and verify that the necessary NDK version is selected and installed.

Conflicting NDK Versions: Having multiple NDK versions installed can sometimes lead to conflicts, especially if the environment variables or project settings are not correctly configured to point to the desired version. Gradle might pick up the wrong NDK version, resulting in a mismatch. Android Studio usually manages this well, but manual configurations or customizations can introduce conflicts. This is often the case in projects migrated from older versions of Android Studio. Consider only keeping the versions that you need and remove the others.

Step-by-Step Solutions to Resolve the NDK Error

Now that we understand the common causes, let’s delve into the solutions. Here’s a step-by-step guide to troubleshoot and resolve the “No version of NDK matched the requested version” error.

  1. Check Your build.gradle Files: Open both your project-level and module-level build.gradle files. Look for the ndkVersion property within the android block. If it’s explicitly set, ensure that the specified version is installed and compatible with your AGP version.
  2. Install the Required NDK Version: Open Android Studio’s SDK Manager (Android Studio > SDK Manager). Go to the SDK Tools tab. Make sure the required NDK version is selected and installed. If it’s already installed, try uninstalling and reinstalling it.
  3. Sync Your Project with Gradle Files: After making changes to your build.gradle files or installing/uninstalling NDK versions, sync your project with Gradle files. You can do this by clicking File > Sync Project with Gradle Files in Android Studio.
  4. Clean and Rebuild Your Project: Sometimes, cached build files can cause issues. Clean your project by clicking Build > Clean Project and then rebuild it by clicking Build > Rebuild Project.
  5. Invalidate Caches and Restart: If the issue persists, try invalidating caches and restarting Android Studio. Go to File > Invalidate Caches / Restart… and choose Invalidate and Restart.

The following snippet illustrates how to specify an NDK version in your build.gradle file:

android { ndkVersion '21.4.7075529' ... } 

However, a more robust approach is to let Gradle manage the NDK version automatically:

android { ... ndk { abiFilters 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a' } } 

By removing the explicit ndkVersion and letting Gradle handle it, you reduce the risk of version conflicts and ensure compatibility. Remember to sync your project after making these changes.

Advanced Troubleshooting Techniques

If the basic solutions don’t work, you might need to employ more advanced troubleshooting techniques. These involve diving deeper into your project’s configuration and environment.

Check Environment Variables: Ensure that your environment variables, particularly those related to Android SDK and NDK paths, are correctly set. Incorrect or outdated environment variables can interfere with Gradle’s ability to locate the NDK. Verify that ANDROID_HOME points to your Android SDK installation directory and that the NDK is located within that directory.

Review Gradle Settings: Examine your Gradle settings file (gradle.properties) for any custom configurations related to the NDK. Look for properties like android.useDeprecatedNdk or android.ndkPath that might be overriding the default behavior. Comment out or remove these properties if they are not necessary.

Examine the Error Logs: Carefully analyze the error logs in the Gradle console for more detailed information about the NDK version mismatch. The logs often provide clues about the specific files or configurations causing the issue. Look for lines that mention the NDK path or version, and use that information to pinpoint the problem.

Featured Snippet:

To quickly resolve the “No version of NDK matched the requested version” error, ensure your Android Gradle Plugin (AGP) version is compatible with your installed NDK version. Verify the ndkVersion in your build.gradle file matches an installed NDK version in Android Studio’s SDK Manager. If the versions don’t match, either update the NDK through the SDK Manager or remove the explicit ndkVersion from your build.gradle to let Gradle automatically manage the compatible NDK version.

Preventing Future NDK Version Issues

Prevention is always better than cure. Here are some best practices to avoid NDK version issues in the future.

  • Keep Your Android Studio and Gradle Plugin Up-to-Date: Regularly update Android Studio and the Android Gradle Plugin to the latest stable versions. These updates often include bug fixes and improvements related to NDK compatibility.
  • Use Gradle Managed NDK: Avoid explicitly specifying the ndkVersion in your build.gradle file unless absolutely necessary. Let Gradle manage the NDK version automatically to ensure compatibility with your AGP version.

Consider the following points when managing NDK versions:

  • Always check the official Android documentation for NDK and AGP compatibility information.
  • Test your app on different Android devices and emulators to ensure that the native code is working correctly across different architectures.
Infographic here: NDK version compatibility chart with AGP versions
By adhering to these practices, you can minimize the risk of encountering NDK version issues and ensure a smoother development experience. Remember to always keep your development environment up-to-date and to carefully manage your project's dependencies.
What does "No version of NDK matched the requested version" mean?
This error indicates that the Android Gradle Plugin (AGP) in your project cannot find a compatible version of the Native Development Kit (NDK) required for building native code.
How do I check my NDK version?
Open Android Studio's SDK Manager (Android Studio > SDK Manager). Go to the SDK Tools tab and look for the installed NDK versions.
Can I use multiple NDK versions in one project?
While it's possible to have multiple NDK versions installed, it's generally recommended to use a single compatible version to avoid conflicts. Ensure your build.gradle and environment variables are configured correctly.
What is the best way to manage NDK versions in Android Studio?
The best practice is to let Gradle manage the NDK version automatically by not explicitly specifying ndkVersion in your build.gradle file. This ensures compatibility with your AGP version.
It's clear that resolving the "**No version of NDK matched the requested version**" error requires a systematic approach, starting with understanding the relationship between your AGP, NDK, and project settings. By following the troubleshooting steps outlined above, you can effectively diagnose and fix the issue. Remember to keep your development tools updated and adopt best practices for managing NDK versions to prevent future problems. Now that you're armed with this knowledge, go forth and build amazing Android apps with native code! If you're still facing challenges, consider exploring the Android developer community forums or consulting with experienced Android developers for further assistance. And be sure to revisit this guide if you encounter similar issues in the future. **Question & Answer :** After updating to **Android Gradle plugin** `3.6.0` (released Feb 24, 2020), several project independently started failing with:
No version of NDK matched the requested version 20.0.5594570. Versions available locally: 21.0.6113669 

It’s quite simple to “fix” this locally by installing the older expected ndk version:

sdkmanager 'ndk;20.0.5594570' 

However, my question is: Where and how is this older version specified? And how do I update it so it matches the latest version 21.0.6113669?

The following solutions assume that the machine you are using currently has NDK installed and was previously able to build your project but started failing with the error “No version of NDK matched the requested version” after updating to Android Gradle plugin 3.6.0. Before proceeding make sure to have NDK installed.

Option 1:

You can simply select your locally installed NDK in the Project Structure Dialog

You can open the Project Structure Dialog by clicking File > Project Structure... or by pressing the hotkeys CTRL + ALT + SHIFT + S (on windows)

Once the Project Structure Dialog is open, go to SDK Location and select your locally installed version of NDK under Android NDK Location. Typically this is installed somewhere in your user folder then \AppData\Local\Android\Sdk\ndk\%ndk version% at least for Windows.

Project Structure dialog screenshot - from Android Studio 3.6 Build #AI-192.7142.36.36.6200805, built on February 12, 2020

Option 2:

Doing option 1 will edit your local.properties file for you and will work in most cases. But if you want to use a consistent NDK version on all machines you build the project with, according to this official guide, you can configure it from your module gradle script. Simply add the ndkVersion in your module gradle script’s android{} block like so.

android { ndkVersion "major.minor.build" } 

replacing the string between the doublequotes with the NDK version you want to use

Option 3:

If you want all projects built on a particular machine to use the same NDK version, you can also set ANDROID_NDK_HOME environment variable with the path to the NDK folder.