Reputation: 41
I'm running into number of problems while trying to run GStreamer Android Tutorials on Windows. I'am new to Android NDK so this could be a really simple issue but I couldn't figure out how to solve it.
These are the build error messages when I try to build the project
Build command failed.
Error while executing process D:\gstreamer\android-ndk-r19b-windows-x86_64\android-ndk-r19b\ndk-build.cmd with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=C:\xxx\xxx\gst-docs-master\examples\tutorials\android\android-tutorial-1\jni\Android.mk NDK_APPLICATION_MK=C:\xxx\xxx\gst-docs-master\examples\tutorials\android\android-tutorial-1\jni\Application.mk APP_ABI=armeabi-v7a NDK_ALL_ABIS=armeabi-v7a NDK_DEBUG=0 APP_PLATFORM=android-16 NDK_OUT=C:/xxx/xxx/gst-docs-master/examples/tutorials/android/android-tutorial-1/build/intermediates/ndkBuild/release/obj NDK_LIBS_OUT=C:\xxx\xxx\gst-docs-master\examples\tutorials\android\android-tutorial-1\build\intermediates\ndkBuild\release\lib NDK_APPLICATION_MK=jni/Application.mk GSTREAMER_JAVA_SRC_DIR=src GSTREAMER_ROOT_ANDROID=D:/gstreamer/gstreamer-1.0-android-universal-1.15.1 GSTREAMER_ASSETS_DIR=src/assets APP_SHORT_COMMANDS=false LOCAL_SHORT_COMMANDS=false -B -n}
process_begin: CreateProcess(NULL, "", ...) failed.
*** Android NDK: Assertion failure: SYSROOT_LINK is not defined . Stop. Open File
When I clicked the "Open File" it has sent me to gstreamer-1.0.mk file and the lines below.
ifdef SYSROOT SYSROOT_GST_INC := $(SYSROOT) SYSROOT_GST_LINK := $(SYSROOT)
else ifdef SYSROOT_INC $(call assert-defined, SYSROOT_LINK) ifdef SYSROOT_LINK SYSROOT_GST_INC := $(SYSROOT_INC) SYSROOT_GST_LINK := $(SYSROOT_LINK) endif else SYSROOT_GST_INC := $(NDK_PLATFORMS_ROOT)/$(TARGET_PLATFORM)/arch-$(TARGET_ARCH) SYSROOT_GST_LINK := $(SYSROOT_GST_INC) endif endif
I think the problem is about SYS_ROOT as mentioned in the error message but I don't know what "SYS_ROOT" means or "NDK_PROJECT_PATH" is.
I have added gstAndroidRoot to gradle.properties so while building this won't be a problem.
Upvotes: 3
Views: 2467
Reputation: 247
For Windows 10, Android Studio 3.5. This worked for me.
Download the entire gstreamer android studio tutorial directory from here.
Open Android Studio -> Open an existing Android Studio Project
Open the entire android tutorial directory examples/tutorials/android
as a project
Once the project is open change the view on the left side of the screen to Project
Right click near local.properties
. Right click -> 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.
Now we need to set up NDK directory. Make sure you download and have NDK enabled under SDK tools.
This will download the latest NDK version. However gstreamer currently will not build with the latest NDK. We need to download NDK Revision 18b from here. 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 under AppData\Local\Android\Sdk\ndk
You should now have two folders within Android\Sdk\ndk
. 20.0.5594570 (or latest version)
and android-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. Under Gradle Scripts
select the build.gradle
for the appropriate tutorial. Change the compileSdkVersion 29
, minSDKVersion 15
, and targetSDKVersion 29
.
Upvotes: 3