Building the NDK

The latest version of this document is available at

Both Linux and Windows NDKs are built on Linux machines. Windows host binaries are cross-compiled with MinGW.

Building the NDK for Mac OS X requires at least 10.8.


  • AOSP NDK Repository
    • Check out the branch master-ndk

      repo init -u \
          -b master-ndk
      # Googlers, use
      repo init -u \
          persistent- \
          -b master-ndk

If you wish to rebuild a given release of the NDK, the release branches can also be checked out. They're named ndk-release-r${RELEASE} for newer releases, but ndk-r{RELEASE}-release for older releases. For example, to check out the r19 release branch, use the -b ndk-release-r19 flag instad of -b master-ndk.

Linux dependencies are listed in the Dockerfile. You can use docker to build the NDK:

docker build -t ndk-dev infra/docker
docker run -it -u $UID -v `realpath ..`:/src -w /src/ndk ndk-dev ./

Building on Mac OS X has similar dependencies as Linux, but also requires Xcode.

Running tests requires that adb is in your PATH. This is provided as part of the Android SDK.

Building the NDK

For Linux or Darwin:

$ python

For Windows, from Linux:

$ python --system windows64  # Or "windows", for a 32-bit host. will also build all of the NDK tests. This takes about as long as building the NDK itself, so pass --no-build-tests to skip building the tests. They can be built later with python --rebuild.

Note: The NDK's build and test scripts are implemented in Python 3 (currently 3.6). will bootstrap by building Python 3.6 from source before running, but does not do this yet. also can be run outside of a complete development environment (as it is when it is run on Windows), so a Python 3.6 virtualenv is recommended.


By default, will also package the NDK. To skip the packaging step, use the --no-package flag. To avoid packaging an incomplete NDK, packaging will not be run if --module was passed unless --force-package was also provided.