Ask Your Question

Revision history [back]

Android Studio OpenCV please help!

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:

How to use opencv in android studio using gradle build tool?

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!

Android Studio OpenCV please help!

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:

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

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!

Android Studio OpenCV please help!

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/20600674#20600674http://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!