我是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'])
}
答案 0 :(得分:3)
正如项目 build.gradle
文件的说明所示:
//注意:不要在此处放置应用程序依赖项;他们属于
//在单个模块build.gradle文件中
删除该gradle文件中的compile语句:
compile project(":libs:boofcv-libs")
将它们复制到其他(模块' s) build.gradle
,并使依赖项看起来像这样:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:20.+'
compile project(":libs:boofcv-libs")
}
答案 1 :(得分:0)
BoofCV位于maven中心,所以您也可以执行以下操作:
['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'
答案 2 :(得分:0)
所以它会是这样的:
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"
}