我在这里遵循@Paito定义的步骤:
https://stackoverflow.com/a/20600674/1291489
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 List03-19 19:54:46.144 E/OpenCV/StaticHelper﹕ OpenCV error: Cannot load info library for OpenCV03-19 19:54:46.144 D/OpenCV/StaticHelper﹕ library List: ""03-19 19:54:46.144 D/OpenCV/StaticHelper﹕ First attempt to load libs03-19 19:54:46.144 D/OpenCV/StaticHelper﹕ Trying to init OpenCV libs03-19 19:54:46.144 D/OpenCV/StaticHelper﹕ Trying to load library opencv_java03-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和样本.
解决方法 如果你的gradle插件是0.7.2,你应该在/ main / jnilibs文件夹中添加* .so文件,并将opencv java添加为库,按照我在这里介绍的步骤 *** 作.How to use opencv in android studio using gradle build tool?
总结以上是内存溢出为你收集整理的如何为Android Studio打包和链接OpenCV binares和OpenCV Java SDK?全部内容,希望文章能够帮你解决如何为Android Studio打包和链接OpenCV binares和OpenCV Java SDK?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)