I'm trying to build SFML app for android, but getting some strange errors.
First, my app configured like that:
Android.mk
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := sfml-example
LOCAL_SRC_FILES := main.cpp
LOCAL_SHARED_LIBRARIES := sfml-system
LOCAL_SHARED_LIBRARIES += sfml-window
LOCAL_SHARED_LIBRARIES += sfml-graphics
LOCAL_SHARED_LIBRARIES += sfml-audio
LOCAL_SHARED_LIBRARIES += sfml-network
LOCAL_SHARED_LIBRARIES += sfml-activity
LOCAL_SHARED_LIBRARIES += openal
LOCAL_WHOLE_STATIC_LIBRARIES := sfml-main
include $(BUILD_SHARED_LIBRARY)
$(call import-module,third_party/sfml)
Application.mk
NDK_TOOLCHAIN_VERSION := 4.9
APP_PLATFORM := android-19
APP_STL := c++_static
APP_ABI := all
APP_MODULES := sfml-activity sfml-example
APP_OPTIM := release
APP_CFLAG := -g -O3
It's compiled and work fine on Android 5,6,7. But when I tried to launch app on android 6.0 I got an error:
java.lang.RuntimeException: Unable to start activity ComponentInfo{org.sfml_test.android/android.app.NativeActivity}: java.lang.IllegalArgumentException: Unable to load native library: /data/app/org.sfmldev.android-1/lib/arm/libsfml-activity.so
I found similar problem in this question.
So I tried to write activity, which should load SFML lib. Activity code:
package org.sfmldev.android;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
public class SFMLLoader extends Activity {
static {
System.loadLibrary("sfml-activity");
System.loadLibrary("sfml-example");
}
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = new Intent(SFMLLoader.this, android.app.NativeActivity.class);
SFMLLoader.this.startActivity(intent);
}
}
And i change my AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="org.sfmldev.android">
<uses-feature android:glEsVersion="0x00010001" />
<uses-permission android:name="android.permission.VIBRATE" />
<application android:label="#string/app_name"
android:icon="#drawable/sfml_logo"
android:hasCode="false"
android:allowBackup="false"
android:testOnly="false"
tools:ignore="GoogleAppIndexingWarning">
<activity android:name="org.sfmldev.android.SFMLLoader"
android:label="#string/app_name"
android:configChanges="keyboardHidden|orientation|screenSize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="android.app.NativeActivity"
android:label="#string/app_name"
android:icon="#drawable/sfml_logo"
android:configChanges="keyboardHidden|orientation|screenSize">
<meta-data android:name="android.app.lib_name" android:value="sfml-activity" />
<meta-data android:name="sfml.app.lib_name" android:value="sfml-example" />
</activity>
</application>
</manifest>
And now I have new error on any devices:
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{org.sfmldev.android/org.sfmldev.android.SFMLLoader}: java.lang.ClassNotFoundException: Didn't find class "org.sfmldev.android.SFMLLoader" on path: DexPathList[[directory "."],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
I'm already tried to make relative path, disable instance run, clean project, restart android studio, restart OS, delete .idea and .gradle
You are supposed to load your library on runtime not on activity create:
public class SFMLLoader extends Activity {
static {
System.loadLibrary("sfml-activity");
System.loadLibrary("sfml-example");
}
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
...
}
}
Just forgot to remove android:hasCode="false" from AndroidManifest.xml
Related
Trying to test the application with butterknife 8.4.0 and some sample text and I keep getting a NullPointerException The actual code itself is fine but I believe Android.mk might be the issue. So here are the portions of that makefile that are under question:
LOCAL_STATIC_JAVA_LIBRARIES := \
dialer-butterknife-target \
dialer-butterknife-compiler-target \
dialer-butterknife-annotations-target \
PROCESSOR_LIBRARIES_TARGET := \
dialer-auto-value \
dialer-butterknife \
dialer-butterknife-compiler \
dialer-butterknife-annotations \
PROCESSOR_JARS := $(call java-lib-deps, $(PROCESSOR_LIBRARIES_TARGET))
# Necessary for annotation processors to work correctly.
LOCAL_ADDITIONAL_DEPENDENCIES += $(PROCESSOR_JARS)
LOCAL_JACK_FLAGS += --processorpath $(call normalize-path- list,$(PROCESSOR_JARS))
LOCAL_JAVACFLAGS += -processorpath $(call normalize-path-list,$(PROCESSOR_JARS))
LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := \
dialer-butterknife:../../../prebuilts/tools/common/m2/repository/com/jakewharton/butterknife/8.4.0/butterknife-8.4.0.aar \
dialer-butterknife-compiler:../../../prebuilts/tools/common/m2/repository/com/jakewharton/butterknife-compiler/8.4.0/butterknife-compiler-8.4.0$(COMMON_JAVA_PACKAGE_SUFFIX) \
dialer-butterknife-annotations:../../../prebuilts/tools/common/m2/repository/com/jakewharton/butterknife-annotations/8.4.0/butterknife-annotations-8.4.0$(COMMON_JAVA_PACKAGE_SUFFIX) \
include $(CLEAR_VARS)
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
LOCAL_MODULE := dialer-butterknife-target
LOCAL_SDK_VERSION := current
LOCAL_SRC_FILES := ../../../prebuilts/tools/common/m2/repository/com/jakewharton/butterknife/8.4.0/butterknife-8.4.0.aar
LOCAL_UNINSTALLABLE_MODULE := true
include $(BUILD_PREBUILT)
include $(CLEAR_VARS)
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
LOCAL_MODULE := dialer-butterknife-annotations-target
LOCAL_SDK_VERSION := current
LOCAL_SRC_FILES := ../../../prebuilts/tools/common/m2/repository/com/jakewharton/butterknife-annotations/8.4.0/butterknife-annotations-8.4.0$(COMMON_JAVA_PACKAGE_SUFFIX)
LOCAL_UNINSTALLABLE_MODULE := true
include $(BUILD_PREBUILT)
include $(CLEAR_VARS)
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
LOCAL_MODULE := dialer-butterknife-compiler-target
LOCAL_SDK_VERSION := current
LOCAL_SRC_FILES := ../../../prebuilts/tools/common/m2/repository/com/jakewharton/butterknife-compiler/8.4.0/butterknife-compiler-8.4.0$(COMMON_JAVA_PACKAGE_SUFFIX)
LOCAL_UNINSTALLABLE_MODULE := true
include $(BUILD_PREBUILT)
Here is the error in stack trace:
07-06 09:38:28.690 24980 24980 E AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.dialer/com.android.dialer.about.LicenseMenuActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.TextView.setText(java.lang.CharSequence)' on a null object reference
07-06 09:38:28.690 24980 24980 E AndroidRuntime: Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.TextView.setText(java.lang.CharSequence)' on a null object reference
Hi all I am using jni code to generate some number in my application. When I install and run it on my device it is working fine as expected with jni code, but when I am creating AOSP build flashing system.img and boot.img in my device getting UnsatisfiedLinkError at run time for jni code.
My Project structure, code snippet and logcat is given below
Below code is for JNI Wrapper class
RandomGenerator.java
public final class RandomGenerator {
private RandomGenerator() {}
public static native String getNumber(String code);
/***
* load native library in static initializer
*/
static
{
System.loadLibrary("code-generator");
}
}
Android.mk
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := code-generator
LOCAL_SRC_FILES := $(call all-cpp-files-under, samplecode/src/main/jni)
LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog
include $(BUILD_SHARED_LIBRARY)
Application.mk
APP_ABI := armeabi armeabi-v7a arm64-v8a
build.gradle
defaultConfig {
applicationId "com.jni.test.service"
minSdkVersion project.ext.minSdkVersion
targetSdkVersion project.ext.targetSdkVersion
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
signingConfig signingConfigs.config
multiDexEnabled true
ndk{
moduleName "code-generator"
}
}
sourceSets.main.jniLibs.srcDirs = ['./src/main/jni/']
externalNativeBuild {
// Encapsulates your CMake build configurations.
cmake {
// Provides a relative path to your CMake build script.
path "/src/main/jni/CMakeLists.txt"
}
}
And below on main application Android.mk code snippet.
Android.mk
#Building JNI library for Code generator
include $(CLEAR_VARS)
LOCAL_MODULE := code-generator
LOCAL_SRC_FILES := $(call all-cpp-files-under, samplecode/src/main/jni)
include $(BUILD_SHARED_LIBRARY)
#Build JNI library end
#Building sample application
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS :=optional
LOCAL_SRC_FILES := $(call all-java-files-under, samplecode/src/main/java)
LOCAL_RESOURCE_DIR :=$(LOCAL_PATH)/samplecode/src/main/res
LOCAL_ASSET_DIR := $(LOCAL_PATH)/samplecode/src/main/assets
LOCAL_MANIFEST_FILE := samplecode/src/main/AndroidManifest.xml
LOCAL_PACKAGE_NAME := samplecode
LOCAL_SHARED_LIBRARIES := code-generator
LOCAL_SDK_VERSION := current
LOCAL_CERTIFICATE :=platform
LOCAL_PROGUARD_ENABLED := disabled
include $(BUILD_PACKAGE)
include $(CLEAR_VARS)
LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := j2xx:mylib/libs/j2xx.jar
include $(BUILD_MULTI_PREBUILT)
#Building sample application end
Now the problem is when I run android application with this code it is working fine as expected jni code, even AOSP build successfully completed. But When I flash AOSP build I getting
UnsatisfiedLinkError at runtime.
09-16 20:32:09.780 10782-10782/com.jni.test.service W/dalvikvm: Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Lcom/jni/test/service/sample/RandomGenerator;
09-16 20:32:09.780 10782-10782/com.jni.test.service D/AndroidRuntime: Shutting down VM
09-16 20:32:09.780 10782-10782/com.jni.test.service W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0xb0cdcb20)
09-16 20:32:09.790 10782-11129/com.jni.test.service I/path: /data/data/com.jni.test.service/files/config.xml
09-16 20:32:09.800 10782-10782/com.jni.test.service E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.jni.test.service, PID: 10782
java.lang.UnsatisfiedLinkError:
Couldn't load code-generator from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.jni.test.samplecode-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.jni.test.samplecode-2, /vendor/lib, /system/lib]]]: findLibrary returned null
at java.lang.Runtime.loadLibrary(Runtime.java:358)
at java.lang.System.loadLibrary(System.java:526)
at com.jni.test.service.sample.RandomGenerator.<clinit>(Random.java:40)
at com.jni.test.service.MainActivity.onCreate(MainActivity.java:101)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
Note: After AOSP build .so file creating related to code-generator but
not finding path in application, I believe something went wrong with
Android.mk configuartion. Please can someone help me on this.
Thanks in advance.
I have just started learning cocos2d-x-3.11.1 in android studio (trying to compile with native C++ language) and I am getting this following error and a message on my phone "Unfortunately libcocos2dx has stopped"
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.granjur.org-1/base.apk"],nativeLibraryDirectories=[/data/app/com.granjur.org-1/lib/arm64, /vendor/lib64, /system/lib64]]] couldn't find "libMyGame.so"
I have configured NDK, SDK and the ANT folders correctly from command line. I've been stuck with this from last two days!
AndroidManifest.xml
<uses-feature android:glEsVersion="0x00020000" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher">
<!-- Tell Cocos2dxActivity the name of our .so -->
<meta-data android:name="android.app.lib_name"
android:value="MyGame" />
<activity
android:name="org.cocos2dx.cpp.AppActivity"
android:screenOrientation="landscape"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>
logcat:
06-20 10:58:32.922 15649-15649/com.granjur.org E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.granjur.org, PID: 15649
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.granjur.org-1/base.apk"],nativeLibraryDirectories=[/data/app/com.granjur.org-1/lib/arm64, /vendor/lib64, /system/lib64]]] couldn't find "libMyGame.so"
at java.lang.Runtime.loadLibrary(Runtime.java:367)
at java.lang.System.loadLibrary(System.java:1076)
at org.cocos2dx.lib.Cocos2dxActivity.onLoadNativeLibraries(Cocos2dxActivity.java:246)
at org.cocos2dx.lib.Cocos2dxActivity.onCreate(Cocos2dxActivity.java:260)
at android.app.Activity.performCreate(Activity.java:6251)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5422)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
06-20 10:59:39.226 15649-15649/com.granjur.org I/Process: Sending signal. PID: 15649 SIG: 9
Any help would be highly appreciated!
Thank you!
Run this command at the game directory to compile the source once:
cocos compile -p android --android-studio
Finally I have a genuine solution to the above problem for users working on android studio project of cocos2dx 3.8.1 above.
Just add this line in Application.mk :)
APP_ABI := armeabi-v7a
Sample Application.mk file :
APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -std=c++11 -fsigned-char
APP_LDFLAGS := -latomic
ifeq ($(NDK_DEBUG),1)
APP_CPPFLAGS += -DCOCOS2D_DEBUG=1
APP_OPTIM := debug
APP_ABI := armeabi-v7a
else
APP_CPPFLAGS += -DNDEBUG
APP_OPTIM := release
APP_ABI := armeabi-v7a
endif
The main problem was the device architecture compatibility with your application. We need to give exclusive support to devices with ARM architecture armeabi-v7a when running proj.android-studio.
Hope this will help many other like me.
Heyho. I've got the same error message as this guy:
"Android NDK app failed to load library"
and i'm trying to transfer these answers here on my situation for hours now, but it doesnt work.
Can someone help me?
It's this opensource project here, which i want to try to get it run on my emulator.
https://github.com/itskewpie/FreeRDP-android
FreeRDPActivity.java
package net.itskewpie.freerdp;
import android.app.Activity;
import android.os.Bundle;
public class FreeRDPActivity extends Activity {
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
static {
System.loadLibrary("freerdp");
}
}
freerdp.c
#include <jni.h>
#include <stdio.h>
#include <freerdp/freerdp.h>
jstring Java_net_itskewpie_freerdp_FreeRDPActivity_test(JNIEnv* env, jobject thiz )
{
android_main();
return (*env)->NewStringUTF(env, "HELLO");
}
Android.mk
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
MY_LIBS_PATH=freerdp-1.0-nevo/libs/armeabi-v7a
LOCAL_MODULE := freerdp-utils
LOCAL_SRC_FILES := $(MY_LIBS_PATH)/libfreerdp-utils.a
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/freerdp-1.0-nevo/include
include $(PREBUILT_STATIC_LIBRARY)
...
Error Message:
FATAL EXCEPTION: main
java.lang.ExceptionInInitializerError
java.lang.Class.newInstanceImpl(Native Method)
java.lang.Class.newInstance(Class.java:1319)
android.app.Instrumentation.newActivity(Instrumentation.java:1054)
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
android.app.ActivityThread.access$600(ActivityThread.java:141)
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
android.os.Handler.dispatchMessage(Handler.java:99)
android.os.Looper.loop(Looper.java:137)
android.app.ActivityThread.main(ActivityThread.java:5041)
java.lang.reflect.Method.invokeNative(Native Method)
java.lang.reflect.Method.invoke(Method.java:511)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
dalvik.system.NativeStart.main(Native Method)
java.lang.UnsatisfiedLinkError: Couldn't load freerdp from loader dalvik.system.PathClassLoader[dexPath=/data/app/net.itskewpie.freerdp-2.apk,libraryPath=/data/app-lib/net.itskewpie.freerdp-2]: findLibrary returned null
java.lang.Runtime.loadLibrary(Runtime.java:365)
java.lang.System.loadLibrary(System.java:535)
net.itskewpie.freerdp.FreeRDPActivity.<clinit>(FreeRDPActivity.java:16)
... 15 more
try out this open source project:
www.freerdp.com
Did you copy the Android.mk exactly as in the github project? Did you copy the relevant libraries too?
#
## libfreerdp.so
#
include $(CLEAR_VARS)
LOCAL_MODULE := freerdp
LOCAL_SRC_FILES := freerdp.c
LOCAL_ARM_MODE := arm
NDK_TOOLCHAIN_ROOT=/opt/android-toolchain
LOCAL_STATIC_LIBRARIES := freerdp-utils
LOCAL_STATIC_LIBRARIES += freerdp-locale
LOCAL_STATIC_LIBRARIES += freerdp-crypto
LOCAL_STATIC_LIBRARIES += freerdp-sspi
LOCAL_STATIC_LIBRARIES += freerdp-codec
LOCAL_STATIC_LIBRARIES += freerdp-core
LOCAL_STATIC_LIBRARIES += freerdp-cache
LOCAL_STATIC_LIBRARIES += freerdp-gdi
LOCAL_STATIC_LIBRARIES += freerdp-rail
LOCAL_STATIC_LIBRARIES += freerdp-channels
LOCAL_STATIC_LIBRARIES += rdpsnd_alsa
LOCAL_STATIC_LIBRARIES += cliprdr
LOCAL_STATIC_LIBRARIES += rdpsnd
LOCAL_STATIC_LIBRARIES += freerdp_android
In the Java side, it looks like you should load the other libraries as well, in the appropriate order:
static {
System.loadLibrary("freerdp-utils");
System.loadLibrary("freerdp-codec");
System.loadLibrary("freerdp-gdi");
System.loadLibrary("freerdp-core");
System.loadLibrary("freerdp-rail");
System.loadLibrary("freerdp-chche");
System.loadLibrary("freerdp-crypto");
System.loadLibrary("freerdp-sspi");
System.loadLibrary("freerdp-channels");
System.loadLibrary("rdpsnd_alsa");
System.loadLibrary("cliprdr");
System.loadLibrary("rdpsnd");
System.loadLibrary("freerdp_android");
System.loadLibrary("freerdp");
}
I have some problem linking the STL in my Native application. Linking fails with both map::operator[] and map::insert while succeeds with other map functions.
My Application.mk is :
APP_STL := gnustl_static
APP_CPPFLAGS := -fexceptions -frtti
APP_CPPFLAGS += -g3
APP_CPPFLAGS += -DDEBUG
APP_ABI := armeabi-v7a
APP_PLATFORM:=android-14
NDK_TOOLCHAIN_VERSION:=4.6
The native code contains two folder level. I created for each internal folder an Android.mk file to compile and generate a static library. I'm using std::map in the deepest folder. Android.mk looks like:
TEMP_PATH_REG := $(call my-dir)
LOCAL_PATH := $(TEMP_PATH_REG)
include $(call all-subdir-makefiles)
LOCAL_PATH := $(TEMP_PATH_REG)
include $(CLEAR_VARS)
LOCAL_MODULE := registration
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../glm/
LOCAL_SRC_FILES := registration_factory.cpp \
inertial.cpp
LOCAL_LDLIBS := -llog -landroid -lEGL
LOCAL_STATIC_LIBRARIES := android_native_app_glue
include $(BUILD_STATIC_LIBRARY)
$(call import-module,android/native_app_glue)
When I build the project i get the following errors:
~/.android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ./obj/local/armeabi-v7a/libregistration.a(registration_factory.o): in function std::_Rb_tree<int, std::pair<int const, xmar::IRegistration*>, std::_Select1st<std::pair<int const, xmar::IRegistration*> >, std::less<int>, std::allocator<std::pair<int const, xmar::IRegistration*> > >::_M_insert_(std::_Rb_tree_node_base const*, std::_Rb_tree_node_base const*, std::pair<int const, xmar::IRegistration*> const&):~/.android-ndk-r8c/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_tree.h:1013: error: undefined reference to 'std::_Rb_tree_insert_and_rebalance(bool, std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::_Rb_tree_node_base&)'
StaticLibrary : libandroid_native_app_glue.a
rm -f obj/local/armeabi-v7a/libandroid_native_app_glue.a
~/.android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ./obj/local/armeabi-v7a/libregistration.a(registration_factory.o): in function std::_Rb_tree_const_iterator<std::pair<int const, xmar::IRegistration*> >::operator--():~/.android-ndk-r8c/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_tree.h:284: error: undefined reference to 'std::_Rb_tree_decrement(std::_Rb_tree_node_base const*)'
~/.android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/arm-linux-androideabi-ar crs ./obj/local/armeabi-v7a/libandroid_native_app_glue.a ./obj/local/armeabi-v7a/objs-debug/android_native_app_glue/android_native_app_glue.o
~/.android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ./obj/local/armeabi-v7a/libregistration.a(registration_factory.o): in function std::_Rb_tree_const_iterator<std::pair<int const, xmar::IRegistration*> >::operator++():~/.android-ndk-r8c/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_tree.h:269: error: undefined reference to 'std::_Rb_tree_increment(std::_Rb_tree_node_base const*)'
Prebuilt : libgnustl_static.a <= <NDK>/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/
~/.android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ./obj/local/armeabi-v7a/libregistration.a(registration_factory.o): in function std::_Rb_tree_iterator<std::pair<int const, xmar::IRegistration*> >::operator--():~/.android-ndk-r8c/sources/cxx-stl/gnu-libstdc++/4.6/include/bits/stl_tree.h:203: error: undefined reference to 'std::_Rb_tree_decrement(std::_Rb_tree_node_base*)'
What I'm doig wrong?
Thanks a lot.
I found a workaround to compile the project.
LOCAL_LDLIBS += ~/.android-ndk-r8c/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/libsupc++.a
LOCAL_LDLIBS += ~/.android-ndk-r8c/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/libgnustl_static.a