I\'m running into a number of issues attempting to build the GStreamer Android tutorials.
My environment is:
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
I was facing the same problem but found nothing clear on internet. But somehow detail study of the problem led me to solve it.
To solve it you need to do the following steps in eclipse:
Windows->preferences->c/c++->build->Environment
Add
button on the right most of the window GSTREAMER_SDK_ROOT_ANDROID
" Value
field enter the location of the GStreamer SDK. In my case it was "C:\GStreamer_SDK
". HERE IS THE PROBLEMMMM.... you need to use forward slash "/
" instead of backward "\
" to make it work properly. so my Gstreamer SDK location will look like this "C:/GStreamer_SDK
"Once you are done with it. You need to do some changes in the Android.mk
file of your project.
Go to the following line
GSTREAMER_NDK_BUILD_PATH := $(GSTREAMER_SDK_ROOT)/share/gst-android/ndk-build/
and remove the ending forward slash from the line of code. so it like will look like this.
GSTREAMER_NDK_BUILD_PATH := $(GSTREAMER_SDK_ROOT)/share/gst-android/ndk-build
Save it and you are done with it!
If you don't remove the slash it will generate the path during build like this
c:/GStreamer_SDK/share/gst-android/ndk-build//gstreamer.mk
Double slashes are problem during build.
Now right click on project->clean
Project
Now build it by right click on your project->build
project.
If eclipse hangs while building just go to task manager and kill the make.exe
service two times.
Run your project on your device or emulator. Have fun!
I posted the above question on the GStreamer Android mailing list and got the following response:
Hi, Unfortunately we forgot to include
pkg-config
in this release for Mac OS X. You can download it from here: http://macpkg.sourceforge.net/
I used homebrew to install pkg-config
and was able to build all of the Android Tutorials via the command line using ndk-build
.
I still have a number of issues in Eclipse:
GSTREAMER_SDK_ROOT_ANDROID
is not defined! - I can not get Eclipse to pick up this variable/bin/sh: pkg-config: command not found
- pkg-config is installed and working via the CLII believe some of the issues are related to Android Issue 33788 and I have attempted to resolve them using CDT 8.0.2 instead of CDT 8.10 but it did not solve either of the above issues.
I have worked around the problem for now by doing the following:
for error1: jni/Android.mk:13: * GSTREAMER_SDK_ROOT_ANDROID is not defined!. Stop.
you can defind GSTREAMER_SDK_ROOT_ANDROID := XXXXX(your Gstreamer_Android_SDK Path) in your Android.mk files!
for error2: fatal error: gst/gst.h: No such file or directory
you can include the (Gstreamer_Android_SDK Path)/include/gstreamer0.10/ in the C/C++ General -> Paths and Symbols -> inlude!
Hope that would help:)
@CAMOBAP Thank you for your post. It really help me. I am possible to build Android example in eclipse. Main problem was:
SHELL := PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin /bin/bash
Fo GSTREAMER_SDK_ROOT_ANDROID
Next: You don't have to remove the ending forward slash from the line of code in MAC and you don't have to add Includes in Eclipse. These dependencies will be solved automatic after first build. Be sure that your Android SDK and NDK are running well in Eclipse. I also added SDK and NDK paths to:
nano .bash_profile
This is running on MAC. I also changed Manifest file to:
android:minSdkVersion="xx"
android:targetSdkVersion="xx" />
For Tutorial 5 from Android Gstreamer you need to add sdcard permission:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
I use ADT with Eclipse and maybe you can define the GSTREAMER_SDK_ROOT_ANDROID as project-wise environment variable by following steps:
Project -> Properties -> C/C++ Build -> Environment -> Add
instead of define it in .mk file.