could not load library "libopencv_java3.so"
Closed this issue · 2 comments
Hi! I'm testing your app with several devices it works perfectly fine with my Moto G 1st gen Android 5.0, but it doesn't in a Samsung Galaxy Grand Neo (API level 17) I've change minimum SDK from Gradle in order to load it on this device.
The problem I'm facing is that it work won't on this device, error is:
E/dalvikvm: dlopen("/data/app-lib/com.packagename/libnative-lib.so") failed: Cannot load library: soinfo_link_image(linker.cpp:1636): could not load library "libopencv_java3.so" needed by "libnative-lib.so"; caused by load_library(linker.cpp:746): library "libopencv_java3.so" not found
followed by:
E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.UnsatisfiedLinkError: Cannot load library: soinfo_link_image(linker.cpp:1636): could not load library "libopencv_java3.so" needed by "libnative-lib.so"; caused by load_library(linker.cpp:746): library "libopencv_java3.so" not found
at java.lang.Runtime.loadLibrary(Runtime.java:371)
at java.lang.System.loadLibrary(System.java:535)
at com.packagename.MainActivity.onCreate(MainActivity.java:45)
at android.app.Activity.performCreate(Activity.java:5326)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1097)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2218)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2309)
at android.app.ActivityThread.access$700(ActivityThread.java:157)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1289)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:5319)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
at dalvik.system.NativeStart.main(Native Method)
jniLIbs symlink is correct and I also tried coping the CPU folders inside a jniLibs folder just to test if the symlink was the problem and still getting the same error.
I downloaded "What's my ABI?" from playstore and both Moto G and Samsung Galaxy Grand Neo are armeabi-v7a
any ideas? Thank you
I've found the solution in this post stackOverflow answer
Basically, what it says is to call System.loadLibrary after BaseLoaderCallback returns LoaderCallbackInterface.SUCCESS.
Hope it helps you if you have this issue in the future!
Also while researching for this I came across with ReLinker v1.2 that states to be a better method for loading libraries, it's as easy as replacing only the System.loadLibrary call and adding it dependency in gradle. You can find it here if you want to try it
Hi,
thanks for sharing this, it should be fixed now.
Cheers