Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - OpenCV error: Cannot load info library for OpenCV

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

like image 239
Nurdin Avatar asked May 12 '16 07:05

Nurdin


4 Answers

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

like image 94
Manish Avatar answered Nov 13 '22 19:11

Manish


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.

like image 42
Grubsy Avatar answered Nov 13 '22 17:11

Grubsy


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

Android Studio Image

like image 3
Icehour Avatar answered Nov 13 '22 19:11

Icehour


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.

like image 1
FD3 Avatar answered Nov 13 '22 19:11

FD3