如何在Android Studio中使用BoofCV?

时间:2016-04-27 11:35:35

标签: android-studio boofcv

如何在Android Studio项目中导入BoofCV?我已经看了here。我完全糊涂了。请给我一步一步的指导。感谢您的帮助。

3 个答案:

答案 0 :(得分:3)

将以下行添加到app / build.gradle应该可以解决问题

compile group: 'org.boofcv', name: 'android', version: '0.23'

将0.23替换为当前版本。

UPDATE 在更新的版本中,您需要执行以下操作:

api group: 'org.boofcv', name: 'boofcv-android', version: '0.30'

答案 1 :(得分:0)

将BoofCV集成到Android Studio中时,我遇到了一些问题。我将其及其解决方案发布在这里,以便对其他人有用。

BoofCV Android支持集成文档链接 https://boofcv.org/index.php?title=Android_support

在Android Studio中添加BoofCV

如果仅使用一个模块,则可以将以下代码添加到app / build.gradle

dependencies {
    api group: 'org.boofcv', name: 'boofcv-android', version: '0.34'
}

如果要使用多个模块,可以将以下代码添加到app / build.gradle

dependencies {
    ['boofcv-android', 'boofcv-core'].each { String a -> api group: 'org.boofcv', name: a, version: '0.34' }
}

与Android依赖项冲突

如果遇到冲突错误,则需要在app / build.gradle中添加以下内容

configurations {
    all*.exclude group: "xmlpull", module: "xmlpull"
    all*.exclude group: "org.apache.commons", module: "commons-compress"
    all*.exclude group: "com.thoughtworks.xstream", module: "commons-compress"
}

验证Dex错误失败

如果无法验证dex文件的方法句柄类型为7,则需要在app / build.gradle中添加以下内容

android {
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

答案 2 :(得分:0)

对于尝试过此操作但仍然无法使用Boofcv的任何人。

同样重要的是添加

dependencies {
     api group: 'org.boofcv', name: 'boofcv-core', version: '0.31'
}

我知道这听起来很明显,但是我没有发现任何明确表明需要这样做的内容。祝你好运!