Ask Your Question
0

Android Studio OpenCV please help!

asked 2014-10-09 10:56:26 -0500

ricardo.nascimento gravatar image

updated 2014-10-09 10:58:21 -0500

I'm currently developing a project in Android Studio and I need to use some OpenCV libraries.

I know that Android Studio currently doesn't support NDK development but when doing my research i found that there are ways to manage things around.

I followed this tutorial to add opencv libraries to my project:

http://stackoverflow.com/questions/17767557/how-to-use-opencv-in-android-studio-using-gradle-build-tool/22427267#22427267

Everything worked fine but when I tried to test an OpenCV example like "FaceDetection" by doing this:

"Go to OpenCV Android SDK, pick a sample project that you’d like to try out.

First, delete the ‘res’ folder inside your own project app/src/main, then place the res folder from the samples inside your app/src/main folder.

First, delete the ‘java’ folder from app/src/main, then copy the ‘src’ folder from the samples in there (note, the src has to be renamed to java).

If you building example with native C++ files, you need to have NDK installed. Download it from Google’s developers portal, and add this line to your local.properties in the top-level of your project, below the sdk.dir line: ndk.dir=/path/to/your/android-ndk Build and run the example!"

I got these errors:

java.lang.UnsatisfiedLinkError: Couldn't load detection_based_tracker from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.example.ricardonascimento.opencvexamples-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.ricardonascimento.opencvexamples-2, /vendor/lib, /system/lib]]]: findLibrary returned null at java.lang.Runtime.loadLibrary(Runtime.java:358) at java.lang.System.loadLibrary(System.java:526)

the problem is when loading library

// Load native library after(!) OpenCV initialization

System.loadLibrary("detection_based_tracker");

What do you suggest to solve this problem? I have searched all over the web but didnt find anything.

Thanks in advance for helping!

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
0

answered 2015-09-09 10:47:06 -0500

I had the same problem on Android Studio, tried all other answers, finally copying the libdetection_based_tracker.so file from OpenCV-android-sdk/samples/face_detection/libs/armeabi-v7a into myProject/app/src/main/jniLibs/armeabi-7a , solved my problem.

edit flag offensive delete link more

Comments

@itackin it doesnt work :(

opencvlover gravatar imageopencvlover ( 2015-12-19 02:32:40 -0500 )edit
Login/Signup to Answer

Question Tools

Stats

Asked: 2014-10-09 10:56:26 -0500

Seen: 1,871 times

Last updated: Oct 09 '14