





Invoking from the Command Line


$ cd <project>
$ <ndk>/ndk-build




$ ndk-build clean

The following options are available:

Remove any previously generated binaries.


rm: fts_read: No such file or directory


Launch build, and display build commands.
Force a complete rebuild.
-B V=1
Force a complete rebuild, and display build commands.
Force a debuggable build (see table 1).
Force a release build (see table 1).
-C <project>

Debuggable versus Release builds



Manifest SettingNDK_DEBUG=0 NDK_DEBUG=1NDK_DEBUG not specified

*1: Useful for profiling.
*2: Default for running ndk-gdb.
*3: Default mode.


The syntax on the command line is, for example:

$ ndk-build NDK_DEBUG=1

64-Bit and 32-Bit Toolchains

Some toolchains come with both 64-bit and 32-bit versions. For example, directories <ndk>/toolchain/<name>/prebuilt/ and <ndk>/prebuilt/ may contain both linux-x86 and linux-x86_64 folders for Linux tools in 32-bit and 64-bit modes, respectively. The ndk-build script automatically chooses a 64-bit version of the toolchain if the host OS supports it. You can force the use of a 32-bit toolchain by using NDK_HOST_32BIT=1 either in your environment or on the ndk-build command line.

Note that 64-bit tools utilize host resources better (for instance, they are faster, and handle larger programs), and they can still generate 32-bit binaries for Android.


You need GNU Make 3.81 or later to use ndk-build or the NDK in general. The build scripts will detect a non-compliant Make tool, and generate an error message.

If you have GNU Make 3.81 installed, but the default make command doesn’t launch it, define GNUMAKE in your environment to point to it before launching ndk-build. For example:

$ export GNUMAKE=/usr/local/bin/gmake
$ ndk-build

You can override other host prebuilt tools in $NDK/prebuilt/<OS>/bin/ with the following environment variables:

$ export NDK_HOST_AWK=<path-to-awk>
$ export NDK_HOST_ECHO=<path-to-echo>
$ export NDK_HOST_CMP=<path-to-cmp>