8

I already setup OpenCV SDK in Android Studio (https://www.learn2crack.com/2016/03/setup-opencv-sdk-android-studio.html) but it seems I got this kind of error message.

05-12 03:30:08.819 5480-5480/my.xxxxx I/art: Late-enabling -Xcheck:jni
05-12 03:30:08.925 5480-5480/my.xxxxx D/OpenCV/StaticHelper: Trying to get library list
05-12 03:30:08.926 5480-5480/my.xxxxx E/OpenCV/StaticHelper: OpenCV error: Cannot load info library for OpenCV
05-12 03:30:08.926 5480-5480/my.xxxxx D/OpenCV/StaticHelper: Library list: ""
05-12 03:30:08.926 5480-5480/my.xxxxx D/OpenCV/StaticHelper: First attempt to load libs
05-12 03:30:08.926 5480-5480/my.xxxxx D/OpenCV/StaticHelper: Trying to init OpenCV libs
05-12 03:30:08.926 5480-5480/my.xxxxx D/OpenCV/StaticHelper: Trying to load library opencv_java3
05-12 03:30:08.926 5480-5480/my.xxxxx D/OpenCV/StaticHelper: Cannot load library "opencv_java3"

I already include opencv_java3 into JNI folder.

enter image description here

halfer
  • 19,824
  • 17
  • 99
  • 186
Nurdin
  • 23,382
  • 43
  • 130
  • 308
  • 1
    Hi, did you find the solution? I am battling with the same problem. I used the tutorial here http://stackoverflow.com/questions/27406303/opencv-in-android-studio .. – kvgr Aug 02 '16 at 11:45
  • @Mohammad have you solved your problem i having the same problem can share your answer if you solved it? – Yirga Mar 22 '17 at 04:43
  • someone in May 2020, and want to solve using deprecated ndk, Please add ' ndk { abiFilters "armeabi-v7a", "x86", "armeabi", "mips" }' inside defaultConfig(App level Gradle) and add 'android.useDeprecatedNdk=true' inside gradle.properties. – Azahar May 12 '20 at 05:07
  • I also have the same problem.. I'm using JavaCameraView and after 20 seconds it throw that message and reset the app – Freddy Daniel Mar 27 '21 at 02:41

5 Answers5

17

If someone is still (March 2020) searching for this error -

 E/OpenCV/StaticHelper: OpenCV error: Cannot load info library for OpenCV

and ends up here on this StackOverflow discussion, here is a helpful clarification from the OpenCV contributor on their site itself.

Ignore this error message. "Info library" is used for special Android configurations, like builds with CUDA support.

Please see this (currently open) issue here - https://github.com/opencv/opencv/issues/15567

Manish
  • 1,735
  • 2
  • 17
  • 30
7

Most online tutorial will tell you to add just armeabi-v7a and x86_64 into your jniLibs folder, but this can cause errors in recent versions of OpenCV. The following briefly describes a few tweaks I used to fix this error when I was experiencing the same issue.

Solution 1:

Make sure the JNI folder you are placing the OpenCV libraries in is named jniLibs

jniLibs Folder

Solution 2:

Copy ALL the directories found in OpenCV-android-skd/sdk/native/libs to your jniLibs folder.

jniLibs folder with all OpenCV libraries added

Recommended:

Even though it is a separate issue involving the emulator, you should also add the code snippet posted by FD3 in your app Module Gradle file. This will prevent the INSTALL_FAILED_NO_MATCHING_ABIS error from occuring after attempting to run your app on an emulator.

Grubsy
  • 71
  • 1
  • 4
3

You can try to include opencv_java3 into jniLibs folder, like this:

Android Studio Image

nickb
  • 59,313
  • 13
  • 108
  • 143
Icehour
  • 31
  • 3
1

Over a year later but I found this to work for me. In you app Module gradle file, add:

splits {
        abi {
            enable true
            reset()
            include 'x86', 'armeabi-v7a', 'x86_64'
            universalApk true
        }
    }

This should be put in with the android brackets. Obviously adjust your includes for which ever you may need.

FD3
  • 361
  • 2
  • 10
0

possibly missing libc++_shared.so library that comes with the Android NDK as explained in https://stackoverflow.com/a/66692717/14019579.

Solution

  1. Download the whole ndk or download libc++_shared.so
  2. copy this library to all the subfolders. Your proj structure should look like this now.

doing this after the first link worked on Studio V4.2.1 and OpenCV 4.5.2