Cant build with using gnustl_static. Got:
'abs' was not declared in this scope
And when trying to build with stlport I cant use c++11 methods.
Here is my Application.mk:
APP_ABI := armeabi-v7a
APP_STL := gnustl_static
APP_CPPFLAGS += -std=c++11 -w
APP_PLATFORM := android-19
APP_OPTIM := release
And Android.mk:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := ModuleName
LOCAL_LDLIBS := -lm -llog -landroid
LOCAL_C_INCLUDES := .......
LOCAL_SRC_FILES += .......
include $(BUILD_SHARED_LIBRARY)
Related
I am getting error during ndk build. I have only one android.mk file and only one Application.mk file in my project
Android NDK: Trying to define local module 'protobuf' in /home/parag.j/AndroidArm//jni/Android.mk.
Android NDK: But this module was already defined by /home/parag.j/AndroidArm//jni/Android.mk.
Here is my Android.mk file
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE=ndktest
LOCAL_SRC_FILES=ndktest.cpp
include $(CLEAR_VARS)
LOCAL_MODULE := c++_shared
LOCAL_SRC_FILES := $(LOCAL_PATH)/inc/build/libc++_shared.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := armnn
LOCAL_SRC_FILES := $(LOCAL_PATH)/inc/build/libarmnn.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := armnnTfParser
LOCAL_SRC_FILES := $(LOCAL_PATH)/inc/build/libarmnnTfParser.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := protobuf
LOCAL_SRC_FILES := $(LOCAL_PATH)/inc/build/libprotobuf.so
include $(PREBUILT_SHARED_LIBRARY)
LOCAL_LDLIBS += -lm -llog -landroid
LOCAL_CFLAGS += -DARM_NEON_64BIT -O3 -mfpu=neon -mcpu=kryo -std=c++14 -pie
LOCAL_SHARED_LIBRARIES := opencv_java3 armnn armnnTfParser protobuf c++_shared
LOCAL_C_INCLUDES := $(LOCAL_PATH)/inc/include\
include $(BUILD_SHARED_LIBRARY)
Here is my Application.mk file
APP_ABI:=arm64-v8a
APP_CFLAGS += -Ofast
APP_OPTIM := release
APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -fexceptions
APP_PLATFORM := android-22
ANDROID_TOOLCHAIN_NAME := clang++
You forgot to (re)set LOCAL_MODULE for the last part of your makefile. I think the last few lines should be:
LOCAL_MODULE=ndktest
LOCAL_SRC_FILES=ndktest.cpp
LOCAL_LDLIBS += -lm -llog -landroid
LOCAL_CFLAGS += -DARM_NEON_64BIT -O3 -mfpu=neon -mcpu=kryo -std=c++14 -pie
LOCAL_SHARED_LIBRARIES := opencv_java3 armnn armnnTfParser protobuf c++_shared
LOCAL_C_INCLUDES := $(LOCAL_PATH)/inc/include
include $(BUILD_SHARED_LIBRARY)
(and get rid of the ndktest lines at the start of the file, of course)
Iam new to android ndk , i have created basic app with android ndk and i have already created all mk files ( android.mk and application.mk ) how to solve the abi error
enter code here LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
#opencv
OPENCVROOT:= C:\OpenCV-OpenCV 3.2-android-sdk
OPENCV_CAMERA_MODULES:=on
OPENCV_INSTALL_MODULES:=on
OPENCV_LIB_TYPE:=SHARED
include ${OPENCVROOT}/sdk/native/jni/OpenCV.mk
LOCAL_SRC_FILES := com_example_working_new.cpp
LOCAL_LDLIBS += -llog
LOCAL_MODULE := MyLibs
include $(BUILD_SHARED_LIBRARY)
my Application.mk file
enter code here APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -fexceptions
APP_ABI := armeabi-v7a
APP_PLATFORM := android-16
the simple way is to make all APP_Abi for different platforms and emulators edit this in your application.mk file.
enter code here
APP_ABI :=all
I've compiled a 3rd party library on Linux using a standalone toolchain, and I'm now trying to load that library in my app.
Problem is I'm getting java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "_Znwj" referenced by "libmxnet_predict.so"
I've tried adding CFLAGS and LDFLAGS, both APP & LOCAL, but to no avail.
Before you ask, I'm developing with ADT because I have to.
This is my Application.mk:
APP_STL := gnustl_shared
APP_CFLAGS += -std=c++11
APP_CPPFLAGS := -frtti -fexceptions
APP_ABI := armeabi-v7a
APP_PLATFORM := android-19
My (simplified) Android.mk:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
OPENCV_LIB_TYPE:=SHARED
OPENCV_CAMERA_MODULES:=off
OPENCV_INSTALL_MODULES:=on
NDK_TOOLCHAIN_VERSION=4.9
include $(CLEAR_VARS)
include $(PREBUILT_SHARED_LIBRARIES)
include C:/OpenCV-2.4.8-android-sdk/sdk/native/jni/OpenCV.mk
LOCAL_MODULE := FreshubML
LOCAL_C_INCLUDES += $(LOCAL_PATH)
LOCAL_SRC_FILES := Mldevlib.cpp \
Tablet.cpp \
Interface.cpp \
LOCAL_LDLIBS += -llog -ldl -landroid -lm -ljnigraphics -lstdc++
C:\KitchenVision\Workspaces\MLDevWorkspace\MLDev\assets\share
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libmxnet_predict
LOCAL_SRC_FILES := lib/armeabi-v7a/libmxnet_predict.so
include $(PREBUILT_SHARED_LIBRARY)
Searching the standalone toolchain I saw that the symbol was referenced in libgnust_shared.so which I added to my project via APP_STL and in libstdc++.so but still, same error.
How do I get this to work?
I am working with Android+NDK+OpenCV.
I keep getting the following build error
Android NDK: Check that ../../OpenCV-2.4.10-android-sdk/sdk/native/jni/../libs/arm64-v8a/libopencv_java.so exists or that its path is correct
../../android-ndk-r10d/build/core/prebuilt-library.mk:45: *** Android NDK: Aborting . Stop.
My Application.mk file is:
APP_PLATFORM := android-8
APP_ABI := armeabi armeabi-v7a arm64-v8a x86 x86_64 mips mips64
APP_OPTIM := debug
NDK_DEBUG := 1
NDK_TOOLCHAIN_VERSION := 4.6
APP_STL := gnustl_shared
APP_CPPFLAGS := -fexceptions -frtti
And my Android.mk file is:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
OPENCV_INSTALL_MODULES := on
include ../../OpenCV-2.4.10-android-sdk/sdk/native/jni/OpenCV.mk
LOCAL_MODULE := document_scanner
LOCAL_SRC_FILES := jni_part.cpp
LOCAL_C_INCLUDES :=../../OpenCV-2.4.10-android-sdk/sdk/native/jni/include
LOCAL_LDLIBS += -llog
include $(BUILD_SHARED_LIBRARY)
Try to move include ../../OpenCV-2.4.10-android-sdk/sdk/native/jni/OpenCV.mk below include $(CLEAR_VARS)
I am trying to use ndk-build to use native code for audio processing from Little Endian in an Android application (I don't have JNI yet).
When I executed ndk-build in jni dir I got ($USER_PATH is path to directory on my computer):
Android NDK: WARNING: Rebuilding libc++ libraries from sources!
Android NDK: You might want to use $NDK/build/tools/build-cxx-stl.sh --stl=libc++
Android NDK: in order to build prebuilt versions to speed up your builds!
Android NDK: ERROR:$USER_PATH/android-ndk-r10/sources/android/compiler-rt/Android.mk:compiler_rt_shared: LOCAL_SRC_FILES points to a missing file
Android NDK: $USER_PATH/Android/android-ndk-r10/sources/android/compiler-rt/libs/armeabi/libcompiler_rt_shared.so exists or that its path is correct
$USER_PATH/android-ndk-r10/build/core/prebuilt-library.mk:45: *** Android NDK: Aborting . Stop.
I saw that is because of PREBUILT_STATIC_LIBRARY which points to missing files.
How can I solve this?
Directory structure:
There are .mk files:
Android.mk
MY_LOCAL_PATH := $(call my-dir)
ifndef LE_SDK_PATH
LE_SDK_PATH := $(call my-dir)
endif
include $(MY_LOCAL_PATH)/le_audioio.mk
include $(MY_LOCAL_PATH)/le_utility.mk
LOCAL_PATH := ${MY_LOCAL_PATH}
include $(CLEAR_VARS)
LOCAL_MODULE := little-endian
LOCAL_STATIC_LIBRARIES := le_audioio le_utility
include $(BUILD_SHARED_LIBRARY)
Application.mk
APP_PLATFORM := android-14
APP_STL := c++_static
APP_ABI := armeabi armeabi-v7a x86
APP_OPTIM := release
APP_CFLAGS += -g
NDK_TOOLCHAIN_VERSION := clang
le_audioio.mk
ifndef LE_SDK_PATH
LE_SDK_PATH := $(call my-dir)
endif
LOCAL_PATH:= $(LE_SDK_PATH)
include $(CLEAR_VARS)
LOCAL_MODULE := le_audioio
LOCAL_EXPORT_C_INCLUDES := $(abspath $(LE_SDK_PATH)/include)
LOCAL_EXPORT_LDLIBS += -lOpenSLES
ifeq ($(TARGET_ARCH_ABI),x86)
LOCAL_SRC_FILES := libs/development/libAudioIO_Android_x86-32_SSSE3.a
else
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
LOCAL_ARM_NEON := true
LOCAL_SRC_FILES := libs/development/libAudioIO_Android_ARMv7a_NEON.a
else
LOCAL_SRC_FILES := libs/release/libAudioIO_Android_ARMv6_VFP2.a
endif
endif
include $(PREBUILT_STATIC_LIBRARY)
le_utilityio.mk
ifndef LE_SDK_PATH
LE_SDK_PATH := $(call my-dir)
endif
LOCAL_PATH:= $(LE_SDK_PATH)
include $(CLEAR_VARS)
LOCAL_MODULE := le_utility
LOCAL_EXPORT_C_INCLUDES := $(abspath $(LE_SDK_PATH)/include)
LOCAL_EXPORT_LDLIBS += -landroid -llog
ifeq ($(TARGET_ARCH_ABI),x86)
LOCAL_SRC_FILES := libs/development/libUtility_Android_x86-32_SSSE3.a
else
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
LOCAL_ARM_NEON := true
LOCAL_SRC_FILES := libs/development/libUtility_Android_ARMv7a_NEON.a
else
LOCAL_SRC_FILES := libs/release/libUtility_Android_ARMv6_VFP2.a
LOCAL_EXPORT_LDLIBS += -latomic
endif
endif
include $(PREBUILT_STATIC_LIBRARY)
Try this a new solution by Google for audio application.