This page shows you how to configure the NDK in your project according to the version of the Android Gradle Plugin (AGP) used by the project.
The steps vary according to the version of AGP used in the project. Find the Android Gradle Plugin version in either of the following locations:
build.gradle file in the projectSelect the version below:
You have the following options to configure the NDK:
ndkVersion property
to set the NDK version.android-sdk/ndk/ directory. Each version is located
in a subdirectory with the version number as its name.For special use cases, use the ndkPath property:
android { ndkPath "/Users/ndkPath/ndk21" // Point to your own NDK }
android { ndkPath = "/Users/ndkPath/ndk21" // Point to your own NDK }
To install the NDK from the command line, do the following:
Use the sdkmanager tool to view versions of CMake and NDK packages that
are available. Similar to other SDK components, the NDK is released through
different channels:
sdkmanager --list [--channel=channel_id] // NDK channels: 0 (stable),
// 1 (beta), or 3 (canary)Pass the sdkmanager the strings for the packages that you want to install.
For example, to install CMake or the NDK, use the following syntax:
sdkmanager --install ["ndk;major.minor.build[suffix]" | "cmake;major.minor.micro.build"] [--channel=channel_id]
--channel option to only install a package if it has been released
in a channel up to and including channel_id.
For more information, see sdkmanager.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2026-03-06 UTC.