I'm running into a number of issues attempting to build the GStreamer Android tutorials.
My environment is:
I am able to build and run the NDK samples both in Eclipse and from the command line.
I have downloaded http://cdn.gstreamer.com/android/arm/gstreamer-sdk-android-arm-debug-2012.11.tar.bz2 and added the GSTREAMER_SDK_ROOT_ANDROID environment variable to my .bash_profile.
When I try to build android-tutorial-1 via Eclipse I get the following error:
12:12:05 **** Incremental Build of configuration Default for project Tutorial1 ****
/apps/tools/android-ndk-r8d/ndk-build all
jni/Android.mk:13: *** GSTREAMER_SDK_ROOT_ANDROID is not defined!. Stop.
12:12:05 Build Finished (took 104ms)
I have tried adding GSTREAMER_SDK_ROOT_ANDROID to the C++ build variables in Eclispe but it makes no difference.
When I try to build via the command line I get the following error:
/bin/sh: pkg-config: command not found
/bin/sh: pkg-config: command not found
/bin/sh: pkg-config: command not found
GStreamer : [GEN] => gst-build/gstreamer_android.c
GStreamer : [COMPILE] => gst-build/gstreamer_android.c
gst-build/gstreamer_android.c:2:21: fatal error: gst/gst.h: No such file or directory
compilation terminated.
make: *** [gst-build/gstreamer_android.o] Error 1
What I can't figure out is gst/gst.h can not be resolved?
Here you faced with two problem
Can be easily solved by set GSTREAMER_SDK_ROOT_ANDROID
environment variable (in eclipse or Android.mk
file) in my case I have specified this variable like this
GSTREAMER_VERSION := 1.4.1
GSTREAMER_SDK_ROOT := /Volumes/Data/Developers/Library/gstreamer-1.0-sdk-android/$(TARGET_ARCH_ABI)-$(APP_OPTIM)-$(GSTREAMER_VERSION)
TARGET_ARCH_ABI
- predefined variable (in my case armeabi-v7a
)APP_OPTIM
- predefined variable release
or debug
In your case GSTREAMER_SDK_ROOT
will be different of course but using predefined vars help a lot if you need support multiple archs
pkg-confing
is not in PATH
As you may see by default there is using sh
shell
/bin/sh: pkg-config: command not found
/bin/sh: pkg-config: command not found
/bin/sh: pkg-config: command not found
It can't find pkg-config
because initially PATH=/usr/bin:/bin:/usr/sbin:/sbin
. In case when you installed pkg-config
by brew
on OSX it has been placed to /usr/local/bin
bash-3.2$ which pkg-config
/usr/local/bin/pkg-config
To fix PATH
you can specify own shell
SHELL := PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin /bin/bash
This is not perfect solution but it works
Since 2.2.0-alpha3
gradle android plugin support external build systems like this (add it in build.gradle
inside android
definition)
android {
...
externalNativeBuild {
ndkBuild {
path "${projectDir.absolutePath}/src/main/jni/Android.mk"
}
}
}
Don't forget cleanup jni.srcDirs
because bad plugin will start first, to cleanup jni.srcDirs
at runtime add
android {
...
task disableDefaultNdkBuild << {
android.sourceSets.main.jni.srcDirs = []
android.sourceSets.main.jniLibs.srcDir 'src/main/libs'
}
preBuild.dependsOn disableDefaultNdkBuild
}
Official guide now available https://gstreamer.freedesktop.org/documentation/tutorials/android/link-against-gstreamer.html