Reputation: 320
I'm trying to build a GStreamer app using Android Studio on windows using the tutorials on their website, but, as already mentioned in other questions, the tutorials are not up-to-date nor seems to work on Android Studio. I've followed the tutorial proposed by Eduardo Fernando at : Gstreamer examples in Android Studio, but it won't build since I can't manage to fix the issue of the jni.h file not found.
> Build command failed.
Error while executing process
C:\Users\spomerleau\AppData\Local\Android\Sdk\ndk-bundle\ndk-build.cmd with
arguments {NDK_PROJECT_PATH=null
APP_BUILD_SCRIPT=C:\Users\spomerleau\Desktop\Android_GSTreamer\Premade_Test_tut5\android-tutorial-5\app\src\main\jni\Android.mk NDK_APPLICATION_MK=C:\Users\spomerleau\Desktop\Android_GSTreamer\Premade_Test_tut5\android-tutorial-5\app\src\main\jni\Application.mk APP_ABI=arm64-v8a NDK_ALL_ABIS=arm64-v8a NDK_DEBUG=1 APP_PLATFORM=android-21 NDK_OUT=C:/Users/spomerleau/Desktop/Android_GSTreamer/Premade_Test_tut5/android-tutorial-5/app/build/intermediates/ndkBuild/debug/obj NDK_LIBS_OUT=C:\Users\spomerleau\Desktop\Android_GSTreamer\Premade_Test_tut5\android-tutorial-5\app\build\intermediates\ndkBuild\debug\lib C:/Users/spomerleau/Desktop/Android_GSTreamer/Premade_Test_tut5/android-tutorial-5/app/build/intermediates/ndkBuild/debug/obj/local/arm64-v8a/libtutorial-5.so}
GStreamer : [GEN] => gst-build-arm64-v8a/gstreamer_android.c
GStreamer : [COMPILE] => gst-build-arm64-v8a/gstreamer_android.c
gst-build-arm64-v8a/gstreamer_android.c:1:10: fatal error: 'jni.h' file not found
#include <jni.h>
^~~~~~~
1 error generated.
make: *** [gst-build-arm64-v8a/gstreamer_android.o] Error 1
I executed the javah command, but the generated .h cannot find the #include either.
I tried the ndk-build command, but it will stop saying the jni.h file is missing.
Any advices on how I could link the jni.h file to the project?
Upvotes: 17
Views: 9182
Reputation: 357
This is due to Android Studio updating/installing to NDK_r16, which deprecated GCC support. Try reverting to NDK_r15c.
Download r15c from https://developer.android.com/ndk/downloads/older_releases.html, then point the app's NDK Location to the extracted folder.
Upvotes: 3
Reputation: 225
This is potentially a problem with the r16 changes in the Android NDK which are fixed upstream by the following commit
The problem is that the NDK moved the header files around into a unified structure and thus broke any user expecting headers in the old locations.
Upvotes: 7
Reputation: 300
jni.h is a header file which is already present in the android ndk package. If it is not present you can either reinstall the package or you can search over the web for the source file which you can get very easily and place that file into the location your compiler is expecting it to be
Upvotes: 0