Setting up Android NDK on Linux in Jenkins: A Guide

To install NDK using the Android SDK Manager, check the “Extras” section after opening the manager. Another option is to use the standalone SDK manager for Android, which is different from the one integrated into Android Studio. However, some users may not have the necessary tabs in their SDK Manager to complete the installation.


My Ubuntu system has Jenkins installed, and building was going smoothly until I began utilizing
android ndk
. I have downloaded the latest NDK and extracted it into the directory /opt/
-linux/ndk-bundle. Additionally, the file /etc/profile.d/ contains relevant information.

export ANDROID_HOME="/opt/android-sdk-linux"
export PATH="$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$PATH"
export ANDROID_NDK_HOME="/opt/android-sdk-linux/ndk-bundle"

However, I continue to encounter an error message stating “common:compileDebugNdk FAILED”.

The build encountered an exception and was unsuccessful.

  • The task ‘:common:compileDebugNdk’ failed to execute due to an error. To solve this issue, download the NDK from and add ndk.dir=path/to/ndk in If you are using Windows, ensure that you escape backslashes, for instance, use C:ndk instead of C:ndk.


The entire instruction is to create a text file named

and place it in the project directory on the Linux machine, containing only one line.


The file, which is automatically generated by
android studio
and typically found in


, fails to open in
Android Studio
when building your project with Jenkins.

Frequently Asked Questions