How to install Android NDK on Ubuntu Linux ?

The Android NDK is a toolset that lets you implement parts of your app in native code, using languages such as C and C++. For certain types of apps, this can help you reuse code libraries written in those languages.

To install and configure the NDK, follow these steps:

$ mkdir ~/Android
$ cd ~/Android

Download android ndk Linux 64 bit from http://developer.android.com/ndk/downloads/index.html , when we written this post, the latest Android version is R23B, which we downloaded and copied to /home/myuser/Android directory. Now, Lets extract this zip as,

$ unzip android-ndk-r23b-linux.zip

This will extract as “Extracting  android-ndk-r23b” into folder “android-ndk-r23b” in ~/Android directory. When uncompressed, the NDK files are contained in a directory called android-ndk-<version>. You can rename the NDK directory if necessary and you can move it to any location on your computer.

Export the NDK path into environment variables,

$ export PATH=$PATH:/home/myuser/Android/android-ndk-r23b

OR You can also edit your ~/.bashrc file and append above line to add NDK permanently to your path to avoid typing above command always.

Check if ndk-build is added to environment,

$ which ndk-build
/home/myuser/Android/android-ndk-r23b/ndk-build

Sometimes, you may need to set NDK_HOME evnvironment variable which you can do the same way as above,

$ export NDK_HOME=/home/myuser/Android/android-ndk-r23b

Leave a Comment