Android Studio ERROR: Executing external native build for ndkBuild when trying to run Gstreamer tutorial
- Download the entire gstreamer android studio tutorial directory (https://gitlab.freedesktop.org/gstreamer/gst-docs/)
2)Open Android Studio -> Open an existing Android Studio Project
- 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
Right click near local.properties file -> New -> File
Create a new file called
gradle.properties
In the new
gradle.properties
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
gstAndroidRoot=/gstreamer_android_binaries
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 (https://gstreamer.freedesktop.org/data/pkg/android/)
- 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 (https://developer.android.com/ndk/downloads/older_releases)
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
Unzip the downloaded NDK 18b directory.
Take the unzipped
android-ndk-r18b
directory and move it to where the ndk folder is underAppData\Local\Android\Sdk\ndk
You should now have two folders within
Android\Sdk\ndk
.20.0.5594570 (or latest version)
andandroid-ndk-r18b
In android studio go to File -> project Structure
Under Android NDK location point to the NDK 18 directory. Example:
C:\Users\AppData\Local\Android\Sdk\ndk\android-ndk-r18b
Connect a phone with USB debugging and run!
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. UnderGradle Scripts
select thebuild.gradle
for the appropriate tutorial. Change thecompileSdkVersion 29
,minSDKVersion 15
, andtargetSDKVersion 29
.