Reputation: 942
I have a static library(libnative.a) which I have generated for arm architecture. Now I want to use the library in my android application using NDK. My Android.mk has
LOCAL_STATIC_LIBRARIES := libnative
i was also trying to load the library in java using System.loadlibrary("path/to/the/libnative.a");
But I get error:
java.lang.UnsatisfiedLinkError: Couldn't load libnative.a from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.example.testsdk-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.testsdk-2, /system/lib]]]: findLibrary returned null
Please help me in loading static libraries in android application. I've already worked with shared libraries. I'm very much familier with loading .so files. Thanks in Advance :)
Upvotes: 2
Views: 2526
Reputation: 13317
You can't load a static library - only shared libraries are actually included in the APK and installed on the phone. When you include the static library when building a shared library (by using LOCAL_STATIC_LIBRARIES := libnative
in your Android.mk), it actually gets linked into the shared library so that the shared library contains all the code from the static one. Therefore you only need to load the shared library using System.loadLibrary()
.
Upvotes: 4