I want to use my existing native library from another Android project, so I just copied the NDK library ( libcalculate.so ) into my new Android project. In my new Android project, I created the libs/armeabi/ folder and placed libcalculate.so there. There is no jni / folder. My test device has an ARM architecture.
In my java code, I load the library:
static{ System.loadLibrary("calculate"); }
When I launch my new Android project, I got an error:
java.lang.UnsatisfiedLinkError: ... nativeLibraryDirectories=[/vendor/lib, /system/lib]]] couldn't find "libcalculate.so"
So, as the error says, the copied native library is not in / verdor / lib or / system / lib, how to solve this problem in my case?
(I unpacked the apk package, in lib / there is libcalculate.so)
==== ===== UPDATE
I also tried to create a jni / folder under the project root and add the Android.mk file to jni /. Android.mk content:
LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := libcalculate LOCAL_SRC_FILES := libcalculate.so include $(PREBUILT_SHARED_LIBRARY)
Then, at the root of the project, I executed ndk-build. After that, the armeabi / and armeabi-v7a / directories are generated by ndk-build (with libcalculate.so inside the folder).
Then I launched the maven project to create the project. The latest apk package has:
lib/armeabi/libcalculate.so lib/armeabi-v7a/libcalculate.so
But when I run my application, the same error code:
java.lang.UnsatisfiedLinkError: ... nativeLibraryDirectories=[/vendor/lib, /system/lib]]] couldn't find "libcalculate.so"