2
votes

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.

2

2 Answers

2
votes

For Windows 10, Android Studio 3.5. This worked for me.

  1. Download the entire gstreamer android studio tutorial directory from here.

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

  3. 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

  5. Right click near local.properties. Right click -> file -> New -> File

  6. Create a new file called gradle.properties

  7. 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.

  8. 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 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

  10. Unzip the downloaded NDK 18b directory.

  11. Take the unzipped android-ndk-r18b directory and move it to where the ndk folder is under AppData\Local\Android\Sdk\ndk

  12. You should now have two folders within Android\Sdk\ndk. 20.0.5594570 (or latest version) and android-ndk-r18b

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

  14. Under Android NDK location point to the NDK 18 directory. Example: C:\Users\AppData\Local\Android\Sdk\ndk\android-ndk-r18b

  15. Connect a phone with USB debugging and run!

  16. 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.

-2
votes

I had the same problem, the reason is that D:/gstreamer/gstreamer-1.0-android-universal-1.15.1/{Arch you are using}/share/gst-android/ndk-build/gstreamer-1.0.mk is calling SYSROOT_LINK that is undefined on line 168, so i commented that line.

ifdef SYSROOT
    SYSROOT_GST_INC := $(SYSROOT)
    SYSROOT_GST_LINK := $(SYSROOT)
else
    ifdef SYSROOT_INC
        # $(call assert-defined, SYSROOT_LINK) <-- COMMENT THIS!
        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

Probably $(call assert-defined, SYSROOT_LINK) is there for some reason, so maybe this isn't a proper solution but it works.