java Android - OpenCV 错误:无法加载 OpenCV 的信息库

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/37180378/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-03 02:16:33  来源:igfitidea点击:

Android - OpenCV error: Cannot load info library for OpenCV

javaandroidopencv

提问by Mohammad Nurdin

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.

我已经在 Android Studio ( https://www.learn2crack.com/2016/03/setup-opencv-sdk-android-studio.html) 中设置了 OpenCV SDK,但似乎我收到了这种错误消息。

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_java3into JNIfolder.

我已经包含opencv_java3JNI文件夹中。

enter image description here

在此处输入图片说明

回答by Grubsy

Most online tutorial will tell you to add just armeabi-v7aand x86_64into your jniLibsfolder, 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.

大多数在线教程会告诉您只将armeabi-v7a和添加x86_64到您的jniLibs文件夹中,但这可能会导致最新版本的 OpenCV 出现错误。下面简要描述了我在遇到相同问题时用来修复此错误的一些调整。

Solution 1:

解决方案1:

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

确保您将放置 OpenCV 库的 JNI 文件夹命名为 jniLibs

jniLibs Folder

jniLibs 文件夹

Solution 2:

解决方案2:

Copy ALLthe directories found in OpenCV-android-skd/sdk/native/libsto your jniLibsfolder.

将找到的所有目录复制OpenCV-android-skd/sdk/native/libs到您的jniLibs文件夹中。

jniLibs folder with all OpenCV libraries added

添加了所有 OpenCV 库的 jniLibs 文件夹

Recommended:

受到推崇的:

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

即使它是一个涉及模拟器的单独问题,您也应该在您的应用程序模块 Gradle 文件中添加FD3发布的代码片段。这将防止在尝试在模拟器上运行您的应用程序后发生INSTALL_FAILED_NO_MATCHING_ABIS错误。

回答by Icehour

You can try to include opencv_java3into jniLibsfolder, like this:

您可以尝试包含opencv_java3jniLibs文件夹中,如下所示:

Android Studio Image

Android Studio 镜像

回答by Manish

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

如果有人仍在(2020 年 3 月)搜索此错误 -

 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.

并在此 StackOverflow 讨论中结束,这里是 OpenCV 贡献者在其网站上的有用说明。

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

忽略此错误消息。 “信息库”用于特殊的 Android 配置,例如支持 CUDA 的构建。

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

请在此处查看此(当前打开的)问题 - https://github.com/opencv/opencv/issues/15567

回答by FD3

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

一年多后,但我发现这对我有用。在你的 app 模块 gradle 文件中,添加:

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.

这应该放在android括号中。显然,根据您的需要调整您的包含。