Ask Your Question
0

Couldn't load native_sample: findLibrary returned null opencv4android

asked 2012-10-26 12:41:19 -0600

ett gravatar image

updated 2012-10-28 09:40:59 -0600

So I was able to run all Android samples except ones using ndk.

I get this in console `

**** Build of configuration Default for project OpenCV Tutorial 3 - Add Native OpenCV ****

D:\pbIxtex\android-ndk-r7c-windows\android-ndk-r7c\ndk-build.cmd 
Install        : libnative_sample.so => libs/armeabi-v7a/libnative_sample.so


**** Build Finished ****

and this is the logcat

10-26 21:28:44.994: E/AndroidRuntime(9469): FATAL EXCEPTION: main
10-26 21:28:44.994: E/AndroidRuntime(9469): java.lang.UnsatisfiedLinkError: Couldn't load native_sample: findLibrary returned null
10-26 21:28:44.994: E/AndroidRuntime(9469):     at java.lang.Runtime.loadLibrary(Runtime.java:429)
10-26 21:28:44.994: E/AndroidRuntime(9469):     at java.lang.System.loadLibrary(System.java:554)
10-26 21:28:44.994: E/AndroidRuntime(9469):     at org.opencv.samples.tutorial3.Sample3Native$1.onManagerConnected(Sample3Native.java:27)
10-26 21:28:44.994: E/AndroidRuntime(9469):     at org.opencv.android.AsyncServiceHelper$1.onServiceConnected(AsyncServiceHelper.java:206)
10-26 21:28:44.994: E/AndroidRuntime(9469):     at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1064)
10-26 21:28:44.994: E/AndroidRuntime(9469):     at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1081)
10-26 21:28:44.994: E/AndroidRuntime(9469):     at android.os.Handler.handleCallback(Handler.java:587)
10-26 21:28:44.994: E/AndroidRuntime(9469):     at android.os.Handler.dispatchMessage(Handler.java:92)
10-26 21:28:44.994: E/AndroidRuntime(9469):     at android.os.Looper.loop(Looper.java:130)
10-26 21:28:44.994: E/AndroidRuntime(9469):     at android.app.ActivityThread.main(ActivityThread.java:3835)
10-26 21:28:44.994: E/AndroidRuntime(9469):     at java.lang.reflect.Method.invokeNative(Native Method)
10-26 21:28:44.994: E/AndroidRuntime(9469):     at java.lang.reflect.Method.invoke(Method.java:507)
10-26 21:28:44.994: E/AndroidRuntime(9469):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:847)
10-26 21:28:44.994: E/AndroidRuntime(9469):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:605)
10-26 21:28:44.994: E/AndroidRuntime(9469):     at dalvik.system.NativeStart.main(Native Method)

if i try ndk-build.cmd -B it goes like this

**** Build of configuration Default for project OpenCV Tutorial 3 - Add Native OpenCV ****

D:\pbIxtex\android-ndk-r7c-windows\android-ndk-r7c\ndk-build.cmd -B 
"Compile++ thumb : native_sample <= jni_part.cpp

Prebuilt       : libgnustl_static.a <= <NDK>/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/

SharedLibrary  : libnative_sample.so

Install        : libnative_sample.so => libs/armeabi-v7a/libnative_sample.so


**** Build Finished ****

but the error is the same. I've tried CDT 8.1.0 and 8.0.2 and ndk r8b and r7c.

I've downloaded the samples from google play and they worked. Any suggestions?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
3

answered 2012-10-31 03:32:23 -0600

The default hardware target for all samples with native part is armeabi-v7a. You need to edit jni/Application.mk and add you hardware before library build.

edit flag offensive delete link more

Comments

Can you explain exactly what to add?

Israelcp gravatar imageIsraelcp ( 2013-01-21 11:21:27 -0600 )edit
1

You need to edit jni/Application.mk file of your project and set APP_ABI := all instead APP_ABI := armeabi-v7a

Alexander Smorkalov gravatar imageAlexander Smorkalov ( 2013-01-22 00:09:58 -0600 )edit
nagarameshwar gravatar imagenagarameshwar ( 2013-03-24 07:10:08 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2012-10-26 12:41:19 -0600

Seen: 5,602 times

Last updated: Oct 31 '12