When using NDK r5b, when I do a build in my jni directory using
$NDK_DIR/ndk-build
it works fine. But When I switch to r6b (just by setting $NDK_DIR differently) and run that same command, I get
/usr/local/android-ndk-r6b/build/core/setup-toolchain.mk:20: *** Android NDK: Assertion failure: TARGET_PLATFORM is not defined . Stop.
What do I need to do differently in r6b that I didn't need to do in r5b?
The solution is to add this line to jni/Application.mk:
APP_PLATFORM := android-8
This is new to r6b. (Not required in r5b or r6, just r6b.)
Related
I want to build GStreamer 1.14.1 on Android Studio 3.3 with gradle 4.10.1, for android API 27 with armeabi-v7a architecture without success. This is the error i'm getting when i try to build:
Build command failed.
Error while executing process /home/folavarria/Android/Sdk/ndk-bundle/ndk-build with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=/home/folavarria/Projects/AndroidStudioProjects/StreamingApp/app/jni/Android.mk NDK_APPLICATION_MK=/home/folavarria/Projects/AndroidStudioProjects/StreamingApp/app/jni/Application.mk APP_ABI=armeabi-v7a NDK_ALL_ABIS=armeabi-v7a NDK_DEBUG=1 APP_PLATFORM=android-16 NDK_OUT=/home/folavarria/Projects/AndroidStudioProjects/StreamingApp/app/build/intermediates/ndkBuild/debug/obj NDK_LIBS_OUT=/home/folavarria/Projects/AndroidStudioProjects/StreamingApp/app/build/intermediates/ndkBuild/debug/lib NDK_APPLICATION_MK=jni/Application.mk GSTREAMER_JAVA_SRC_DIR=src GSTREAMER_ROOT_ANDROID=/home/folavarria/Android/Sdk/gstreamer/1.14.1 GSTREAMER_ASSETS_DIR=src/assets /home/folavarria/Projects/AndroidStudioProjects/StreamingApp/app/build/intermediates/ndkBuild/debug/obj/local/armeabi-v7a/libtutorial-2.so}
GStreamer : [GEN] => gst-build-armeabi-v7a/gstreamer_android.c
GStreamer : [COMPILE] => gst-build-armeabi-v7a/gstreamer_android.c
clang: error: argument unused during compilation: '-mfpu=vfpv3-d16' [-Werror,-Wunused-command-line-argument]
make: *** [gst-build-armeabi-v7a/gstreamer_android.o] Error 1
I tried to silence argument unused warning with "-Wno-unused-command-line-argument" and "-Wno-error" cflags on Android.mk and build.gradle, but isn't working.
Also tried with other GStreamer versions and i'm getting the same error. Even tried with different ndk versions (r15c, r16b and r19b), but this error keeps showing up.
Edit: I tried with Cerbero but isn't compatible with my OS, so i downloaded the latest GStreamer version and this error has gone, now i'm getting other error on Android.mk which is:
SYSROOT_LINK not defined
This was solved commenting a line on Gstreamer-SDK/armv7/share/gst-android/ndk-build/GStreamer.mk that was calling SYSROOT_LINK variable that wasn't defined on line 168.
ifdef SYSROOT
SYSROOT_GST_INC := $(SYSROOT)
SYSROOT_GST_LINK := $(SYSROOT)
else
ifdef SYSROOT_INC
# $(call assert-defined, SYSROOT_LINK) <--- HERE!!!
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
And now it works perfectly, but seems that this isn't the proper way to solve this error.
i am very new to the android ndk and opencv
but i have already run some samples/tutorials of opencv projects in Eclipse
therefore the opencv library should not be a problem
Here i want to run this camera project from github, i think it should work
After I downloaded it and import it into the Eclipse,
I encountered a problem :
When I run it it stops and finishes because the library cannot be loaded in the CameraActivity.
-> System.loadLibrary("PanoHDR");
I have tried to search the web for solutions but they either didn't work or I didn't understand them.
Do I need to do something like "ndk-build" at somewhere to make it work?
Could someone please help me? I cannot find any solution.
here is the default android.mk
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
# Tegra optimized OpenCV.mk
include /Users/milmil/Documents/NVPACK/OpenCV-2.4.5-Tegra-sdk-r2/sdk/native/jni/OpenCV-tegra3.mk
# Linker
LOCAL_LDLIBS += -llog
# Our module sources
LOCAL_MODULE := PanoHDR
LOCAL_SRC_FILES := PanoHDR.cpp Panorama.cpp HDR.cpp NativeLogging.cpp
include $(BUILD_SHARED_LIBRARY)
when i try to use ndk-build in cmd in the main dir of the project
it fails
jni/Android.mk:6: /sdk/native/jni/OpenCV.mk: No such file or directory
make: *** No rule to make target `/sdk/native/jni/OpenCV-tegra3'. Stop.
and it should be caused by this line in the Andriod.mk
include /Users/milmil/Documents/NVPACK/OpenCV-2.4.5-Tegra-sdk-r2/sdk/native/jni/OpenCV-tegra3.mk
I try to use the path of my opencv sdk
include /Android/OpenCV-3.1.0-android-sdk/OpenCV-android-sdk/sdk/native/jni/OpenCV.mk
and it returns this in the cmd
Android NDK: WARNING:jni/Android.mk:PanoHDR: non-system libraries in linker flag
s: -lopencv_java3
Android NDK: This is likely to result in incorrect builds. Try using LOCAL_S
TATIC_LIBRARIES
Android NDK: or LOCAL_SHARED_LIBRARIES instead to list the library dependenc
ies of the
Android NDK: current module
[armeabi-v7a] "Compile++ thumb": "PanoHDR <= PanoHDR.cpp"
The system cannot find the path specified.
make: *** [obj/local/armeabi-v7a/objs/PanoHDR/PanoHDR.o] Error 1
Thank you
=========================================================================
WARNING:jni/Android.mk:PanoHDR: non-system libraries in linker flag
s: -lopencv_java3
the above problem is solved by adding "OPENCV_LIB_TYPE=STATIC" in the android.mk, but still has this error "
[armeabi-v7a] "Compile++ thumb": "PanoHDR <= PanoHDR.cpp"
The system cannot find the path specified.
make: *** [obj/local/armeabi-v7a/objs/PanoHDR/PanoHDR.o] Error 1"
aison#jaison-virtual-machine:~/Downloads/pjproject-2.2.1/pjsip-apps/src/pjsua/android$ ndk-build -fexceptions
Android NDK: WARNING: APP_PLATFORM android-19 is larger than android:minSdkVersion 15 in ./AndroidManifest.xml
Android NDK: WARNING:jni/Android.mk:pjsua: non-system libraries in linker flags: -lpjsua-arm-unknown-linux-androideabi -lpjsip-ua-arm-unknown-linux-androideabi -lpjsip-simple-arm-unknown-linux-androideabi -lpjsip-arm-unknown-linux-androideabi -lpjmedia-codec-arm-unknown-linux-androideabi -lpjmedia-arm-unknown-linux-androideabi -lpjmedia-videodev-arm-unknown-linux-androideabi -lpjmedia-audiodev-arm-unknown-linux-androideabi -lpjmedia-arm-unknown-linux-androideabi -lpjnath-arm-unknown-linux-androideabi -lpjlib-util-arm-unknown-linux-androideabi -lsrtp-arm-unknown-linux-androideabi -lresample-arm-unknown-linux-androideabi -lgsmcodec-arm-unknown-linux-androideabi -lspeex-arm-unknown-linux-androideabi -lilbccodec-arm-unknown-linux-androideabi -lg7221codec-arm-unknown-linux-androideabi -lpj-arm-unknown-linux-androideabi -lgnustl_static -lgcc
Android NDK: This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES
Android NDK: or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the
Android NDK: current module
make: exceptions: No such file or directory
make: *** No rule to make target `exceptions'. Stop.
I am getting that error while doing ndk-build in Ubuntu.
Please help me.
Thanks in advance.
Use ndk-build APP_CPPFLAGS=-fexceptions, or better set this flag in file Application.mk.
I'm woking on running an irrlicht android sample project in android emulator using android-ndk, When I have tried building that sample , the following error occurred:
/Android/android-ndk-r9/ndk-build V=1 NDK_TOOLCHAIN=arm-2010q1
/Android/android-ndk-r9/build/core/init.mk:555: *** Android NDK: Aborting . Stop.
Android NDK: NDK_TOOLCHAIN is defined to the unsupported value arm-2010q1
Android NDK: Please use one of the following values: arm-linux-androideabi-4.6 arm-linux-androideabi-4.8 arm-linux-androideabi-clang3.2 arm-linux-androideabi-clang3.3 mipsel-linux-android-4.6 mipsel-linux-android-4.8 mipsel-linux-android-clang3.2 mipsel-linux-android-clang3.3 x86-4.6 x86-4.8 x86-clang3.2 x86-clang3.3
Then in config.mk file, I have changed:
TOOLCHAIN_ABIS := armeabi armeabi-v7a
to:
TOOLCHAIN_ABIS := armeabi armeabi-v7a arm-linux-androideabi-4.6
and to:
TOOLCHAIN_ABIS := armeabi armeabi-v7a 4.6
In Application.mk file, Changed:
APP_ABI := armeabi-v7a
to:
APP_ABI := armeabi
and then to:
APP_ABI := arm-linux-androideabi-4.6
Nothing changed. I dint got anything more than this, when I googled it. Does anyone know the solution to this issue. Where can I find arm-2010q1 and how to change it? Any help will be appreciated.
NDK_TOOLCHAIN=arm-2010q1 is passed directly to your ndk-build command, you only need to avoid setting it if you don't have this toolchain and keep the default one.
If you aren't calling the ndk-build script by yourself but from eclipse, you can go into your project properties and revert the C/C++ build settings:
I downloaded and installed Android-NDK on my Archlinux, using this package.
Got no issues building (and running) the sample hello-jni following the guide on this page, but if I try to do the same with hello-gl2 I get some errors; it looks like it cannot find some header files:
$ ../../ndk-build
/usr/bin/make -f /opt/android-ndk/build/core/build-local.mk
Compile++ thumb : gl2jni <= gl_code.cpp
/opt/android-ndk/samples/hello-gl2/jni/gl_code.cpp:22:23: error: GLES2/gl2.h: No such file or directory
/opt/android-ndk/samples/hello-gl2/jni/gl_code.cpp:23:26: error: GLES2/gl2ext.h: No such file or directory
--- SNIP ---
GLES2/gl2.h and GLES2/gl2ext.h are however present in $(NDK)/platforms/android-4/arch-arm/usr/include/, and it looks like$(NDK)/build/core/setup-toolchain.mk should set such include path.
Has anybody encountered the same issue? How can I compile this sample?
And then, are there other options to easily build Android-NDK applications? This build system seems quite complicated to me, and I'd prefer using cmake to build my applications.
make sure that APP_ABI and APP_PLATFORM is defined in your Application.mk and your APP_PLATFORM should be higher than android-5... check: gl.h & glext.h not found
for example, in Application.mk define:
APP_ABI := armeabi #armeabi-v7a
APP_STL := stlport_static
APP_PLATFORM := android-8
In my case it was missing the file default.properties with such content:
target=android-5
Put this file into the root project directory. It may help.
You need to use a higher SDK. Level 5 is the minimum to build OpenGL ES 2 code.