尝试在Android Studio上开始使用OpenCV Java SDK创建一个针对14 – 19的应用程序.

1)我在.jar中打包libs

2)添加依赖项:

????…

????依赖{

//OpenCV

compile files('libs/opencv-2.4.8.jar')

compile project(':app:libs:opencv')

}

3)复制OpenCV java文件夹

4)为OpenCV创建并修复build.gradle(与引用的源相同)

5)尝试使用该库

import org.opencv.android.OpenCVLoader;

...

if (!OpenCVLoader.initDebug()) {}

结果:

????应用程序构建和运行,但我得到以下异常:

03-19 19:54:46.144 D/OpenCV/StaticHelper﹕ Trying to get library list

03-19 19:54:46.144 E/OpenCV/StaticHelper﹕ OpenCV error: Cannot load info library for OpenCV

03-19 19:54:46.144 D/OpenCV/StaticHelper﹕ Library list: ""

03-19 19:54:46.144 D/OpenCV/StaticHelper﹕ First attempt to load libs

03-19 19:54:46.144 D/OpenCV/StaticHelper﹕ Trying to init OpenCV libs

03-19 19:54:46.144 D/OpenCV/StaticHelper﹕ Trying to load library opencv_java

03-19 19:54:46.144 D/OpenCV/StaticHelper﹕ Cannot load library "opencv_java"

03-19 19:54:46.154 W/System.err java.lang.UnsatisfiedLinkError: Couldn't load opencv_java: findLibrary returned null

无法看到这里有什么问题.我尝试了每种可能的方法来打包.jar文件,并通过调整重复这些步骤至少10次.

我也试过结构:

-opencv.jar

-libs

-armeabi-v7a

-(.so files)

我正在测试三星GS3Mini和Genymotion 4.1.1,并在两者上获得相同的结果.两者都在运行OpenCV Manager和样本.

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐