Ask Your Question

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:

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 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( at java.lang.System.loadLibrary(

the problem is when loading library

// Load native library after(!) OpenCV initialization


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

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

I had the same problem on Android Studio, tried all other answers, finally copying the 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


@itackin it doesnt work :(

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

Question Tools


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

Seen: 1,871 times

Last updated: Oct 09 '14