Android Studio ERROR: Executing external native build for ndkBuild when trying to run Gstreamer tutorial

  1. Download the entire gstreamer android studio tutorial directory (

2)Open Android Studio -> Open an existing Android Studio Project

  1. Open the entire android tutorial directory examples/tutorials/android as a project

4)Once the project is open change the view on the left side of the screen to Project

  1. Right click near file -> New -> File

  2. Create a new file called

  3. In the new file copy and paste the below code.

# gstAndroidRoot can be set to point to the unpacked GStreamer android top-level directory
# containing each architecture in subdirectories, or else set the GSTREAMER_ROOT_ANDROID
# environment variable to that location

NOTE Change the gstAndroidRoot variable to your file path where you downloaded the gstreamer binaries and unzipped them. Gstreamer can be downloaded from here for Android (

  1. Now we need to set up NDK directory. Make sure you download and have NDK enabled under SDK tools.

9)This will download the latest NDK version. However gstreamer currently will not build with the latest NDK. We need to download NDK Revision 18b (
If you do not use NDK version 18 you will likely get an error Android NDK: Assertion failure: SYSROOT_LINK is not defined . Stop. Open File

  1. Unzip the downloaded NDK 18b directory.

  2. Take the unzipped android-ndk-r18b directory and move it to where the ndk folder is under AppDataLocalAndroidSdkndk

  3. You should now have two folders within AndroidSdkndk. 20.0.5594570 (or latest version) and android-ndk-r18b

  4. In android studio go to File -> project Structure

  5. Under Android NDK location point to the NDK 18 directory. Example: C:UsersAppDataLocalAndroidSdkndkandroid-ndk-r18b

  6. Connect a phone with USB debugging and run!

  7. If you get an error on the phone stating it is for an older version of android. Go back to Android Studio and switch to Android View on the left side of the screen. Under Gradle Scripts select the build.gradle for the appropriate tutorial. Change the compileSdkVersion 29, minSDKVersion 15, and targetSDKVersion 29.

Leave a Comment