[Solved] 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

Solution #1:

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

Respondent: Manish

Solution #2:

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.

Respondent: Grubsy

Solution #3:

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

Android Studio Image

Respondent: Icehour

Solution #4:

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.

Respondent: FD3

Solution #5:

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

Respondent: Shubham Rimjha

The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .

Leave a Reply

Your email address will not be published. Required fields are marked *

New ride at Perth's Adventure World a ‘swing on steroids’ - Australasian Leisure Management npp pharma the truth about anabolic steroid drugs and professional sports