我是android studio的新手,希望在我的项目中包含boofcv库。我正在使用Android studio进行开发。为了包含该库,我执行了以下步骤,并坚持使用build.gradle配置。
第1步:从http://boofcv.org/index.php?title=Download:BoofCV下载经过编译的jar文件
第2步:将settings.gradle更新为
include ':app'
include ':libs:boofcv-libs'
步骤3:我的build.gradle看起来像:
apply plugin: 'com.android.application'
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
}
}
allprojects {
repositories {
jcenter()
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
}
发布于 2015-05-21 14:31:05
正如您的项目的 build.gradle
文件的注释所暗示的:
//注意:不要将您的应用程序依赖项放在此处;它们属于
//在各个模块build.gradle文件中
删除该gradle文件中的编译语句:
compile project(":libs:boofcv-libs")
并将它们复制到其他(模块) build.gradle
中,并使依赖关系看起来如下所示:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:20.+'
compile project(":libs:boofcv-libs")
}
发布于 2015-06-21 14:13:31
BoofCV位于maven central上,因此您也可以执行以下操作:
['calibration','feature','geo','ip','recognition','sfm','android'].each
{ String a -> compile group: 'org.boofcv', name: a, version: '0.18' }
下一步,如果你想要所有的东西,那就更简单了:
compile group: 'org.boofcv', name: "all", version: '0.19-SNAPSHOT'
发布于 2017-10-10 05:44:24
从这个页面获取最新版本https://boofcv.org/index.php?title=Download
所以它会是这样的:
compile "org.boofcv:boofcv-android:0.27"
正如在this page中提到的,为了避免库冲突,请将以下代码添加到app.gradle:
// Remove libraries that conflict with libraries already included with Android
configurations {
all*.exclude group: "xmlpull", module: "xmlpull"
all*.exclude group: "org.apache.commons", module: "commons-compress"
}
https://stackoverflow.com/questions/30376012
复制