Several (my and third-party) native libraries in Android NDK

I need to use two native libraries: one is mine and the other is third-party. While I used them in separate projects, everything was in order. But now I get Exception Ljava/lang/UnsatisfiedLinkError.

I am using Eclipse.

I found out that if I put the existing library in libs / armeabi, Eclipse will start compiling its own code and it will not work. If I rebuild the JNI part from the command line, compilation will succeed, but the third-party library will disappear. Really stupid.

So, how do I tell Eclipse to use the existing .so library with the library that needs to be built? Libraries are independent.

+6
source share
2

NDK , PREBUILT_SHARED_LIBRARY.

, , , librandom.so, libs jni :

mkdir -p jni/libs
cp librandom.so jni/libs

jni/libs/Android.mk:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)
LOCAL_MODULE := random
LOCAL_SRC_FILES := librandom.so
include $(PREBUILT_SHARED_LIBRARY)

, jni/libs.

jni/Android.mk, . NDK Android.mk, :

include $(LOCAL_PATH)/libs/Android.mk

, .

, .

LOCAL_SHARED_LIBRARIES := random

, ndk-build, libs/armeabi/, , .

. . LOCAL_C_INCLUDES .

+9

, . ( stackoverflow) () , .

java . .so libs/armeabi.

. . . , .

+3

All Articles