I am trying to run the gstreamer android tutorial-5 in Android Sudio 3.5 (https://gitlab.freedesktop.org/gstreamer/gst-docs/tree/master/examples/tutorials/android)(https://gitlab.com/eduardoprado/gstreamer-tutorial5) but get the following error:
ERROR: Cause: executing external native build for ndkBuild C:\Users\Downloads\gst_docs_master_examples_tutorials_android\examples\tutorials\android\android-tutorial-1\jni\Android.mk.
I have been following both the gstreamer android tutorials on the gstreamer website along with the stackoverflow thread Gstreamer examples in Android Studio.
The first goal is to get the gstreamer running on android studio.
There are some threads that error is related to white spaces in the path directory but I have checked and all folders have no white space. Below are some of the files that I have been working with and adapting to make the tutorial run.
I have also set my windows environment variable GSTREAMER_ROOT_ANDROID to the unpacked gstreamer binaries along with set it in the android.mk file.
local.properties file
## This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
#Mon Sep 09 08:16:12 EDT 2019
sdk.dir=C\:\\Users\\AppData\\Local\\Android\\Sdk
ndk.dir=C\:\\Users\\AppData\\Local\\Android\\Sdk\\ndk\\20.0.5594570
Android.mk
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := tutorial-5
LOCAL_SRC_FILES := tutorial-5.c
LOCAL_SHARED_LIBRARIES := gstreamer_android
LOCAL_LDLIBS := -llog -landroid
include $(BUILD_SHARED_LIBRARY)
GSTREAMER_ROOT_ANDROID := C\:\\gstreamer_android_binaries
ifndef GSTREAMER_ROOT_ANDROID
$(error GSTREAMER_ROOT_ANDROID is not defined!)
endif
ifeq ($(TARGET_ARCH_ABI),armeabi)
GSTREAMER_ROOT := $(GSTREAMER_ROOT_ANDROID)/arm
else ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
GSTREAMER_ROOT := $(GSTREAMER_ROOT_ANDROID)/armv7
else ifeq ($(TARGET_ARCH_ABI),arm64-v8a)
GSTREAMER_ROOT := $(GSTREAMER_ROOT_ANDROID)/arm64
else ifeq ($(TARGET_ARCH_ABI),x86)
GSTREAMER_ROOT := $(GSTREAMER_ROOT_ANDROID)/x86
else ifeq ($(TARGET_ARCH_ABI),x86_64)
GSTREAMER_ROOT := $(GSTREAMER_ROOT_ANDROID)/x86_64
else
$(error Target arch ABI not supported: $(TARGET_ARCH_ABI))
endif
GSTREAMER_NDK_BUILD_PATH := $(GSTREAMER_ROOT)/share/gst-android/ndk-build/
include $(GSTREAMER_NDK_BUILD_PATH)/plugins.mk
GSTREAMER_PLUGINS := $(GSTREAMER_PLUGINS_CORE) $(GSTREAMER_PLUGINS_PLAYBACK) $(GSTREAMER_PLUGINS_CODECS) $(GSTREAMER_PLUGINS_NET) $(GSTREAMER_PLUGINS_SYS)
G_IO_MODULES := gnutls
GSTREAMER_EXTRA_DEPS := gstreamer-video-1.0
include $(GSTREAMER_NDK_BUILD_PATH)/gstreamer-1.0.mk
build.gradle (app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "26.0.3"
defaultConfig {
applicationId "com.gst_sdk_tutorials.tutorial_5"
minSdkVersion 14
targetSdkVersion 29
externalNativeBuild {
ndkBuild {
arguments "V=1"
}
}
ndk {
moduleName "tutorial-5"
abiFilters 'x86', 'armeabi-v7a', 'arm64-v8a'
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
externalNativeBuild {
ndkBuild {
path 'src/main/jni/Android.mk'
}
}
}
build.gradle (project)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
}
}
allprojects {
repositories {
jcenter()
}
}
gradle-wrapper.properties
#Mon Sep 09 14:10:17 EDT 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
UPDATE Added the argument "V=1" to the ndkBuild section and received the same error:
ERROR: Cause: executing external native build for ndkBuild C:\Users\Downloads\gstreamer-tutorial5-master\app\src\main\jni\Android.mk
ERROR: Cause: executing external native build for ndkBuild C:\Users\Downloads\gst_docs_master_examples_tutorials_android\examples\tutorials\android\android-tutorial-1\jni\Android.mk.
ndkBuild_build_command.txt
file does not belong to your computer, it comes from some Linux machine. Please delete both.cxx
and.externalNdkBuild
directories, and run Gradle Sync again. You will get anotherndkBuild_build_command.txt
file. Please post it here, or use the same parameters as stated in this file, to run ndk-build.cmd from CMD prompt. I hope it will give you good hints to what went wrong.