java sdk 怎么打包,如何打包并链接OpenCV的binares和OpenCV的Java SDK为Android工作室?...

Trying to get started with OpenCV Java SDK on Android Studio creating an app targetting 14 - 19.

I'm following steps defined by @Paito here:

http://stackoverflow.com/a/20600674/1291489

1) I package libs in a .jar

Ed5UJ.png

2) Add dependencies:

...

dependencies {

//OpenCV

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

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

}

3) Copy the OpenCV java folder

hr7fc.png

4) Create and fix build.gradle for OpenCV (same as referenced source)

5) Try to use the library

import org.opencv.android.OpenCVLoader;

...

if (!OpenCVLoader.initDebug()) {}

Results:

App builds and runs but I get the following exception:

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

Not able to see what's wrong here. I tried every possible way of packaging the .jar file and repeated the steps at least 10 times with tweaks.

I also tried structure:

-opencv.jar

-libs

-armeabi-v7a

-(.so files)

I am testing on a Samsung GS3Mini and Genymotion 4.1.1, and getting same results on both. Both are running OpenCV Manager and samples.

解决方案

You should add the *.so files in /main/jniLibs folder if your gradle plugin is 0.7.2+ and add the opencv java as library, follow the steps which I covered here.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值