How to install Android NDK on Ubuntu 16.04 / 18.04

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:Download android ndk suitable for your platform from

 $ mkdir ~/android_ndk 
 $ cd ~/android_ndk 
$ wget -c 

Now extract the zip as,

 $ unzip 

This will extract as “Extracting  android-ndk-r20” into folder “android-ndk-r20” in ~/android_ndk 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:~/android_ndk/android-ndk-r20 

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 

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

$ export NDK_HOME=~/android_ndk/android-ndk-r20

Leave a Comment