[英]How to configure Build.gradle file to include boofcv library in a project for android studio?
i am new to android studio and wants to include boofcv library in my project. 我是android studio的新手,想在我的项目中加入boofcv库。 I am using Android studio for development.
我正在使用Android Studio进行开发。 I have done the following steps in order to include the library and is stuck with build.gradle configuration.
我已经完成了以下步骤,以包括该库并被build.gradle配置所卡住。
Step 1: Have downloaded per-compiled jar files from http://boofcv.org/index.php?title=Download:BoofCV 步骤1:已从http://boofcv.org/index.php?title=Download:BoofCV下载了经过编译的jar文件
Step 2: Have updated settings.gradle as 步骤2:将settings.gradle更新为
include ':app'
include ':libs:boofcv-libs'
Step 3: My build.gradle looks like: 步骤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'])
}
As the note of your project's build.gradle
file will suggest: 正如您的项目的
build.gradle
文件的 build.gradle
将建议:
// NOTE: Do not place your application dependencies here; //注意:请勿在此处放置应用程序依赖项; they belong
他们属于
// in the individual module build.gradle files //在各个模块的build.gradle文件中
Remove the compile statements in that gradle file: 删除该gradle文件中的compile语句:
compile project(":libs:boofcv-libs")
And copy them to other (module's) build.gradle
and make dependencies look like this: 并将它们复制到其他(模块的)
build.gradle
,并使依赖项如下所示:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:20.+'
compile project(":libs:boofcv-libs")
}
BoofCV is on maven central so you could just do the following too: BoofCV位于maven中央,因此您也可以执行以下操作:
['calibration','feature','geo','ip','recognition','sfm','android'].each
{ String a -> compile group: 'org.boofcv', name: a, version: '0.18' }
In the next it will be even easier if you just want everything: 在接下来的过程中,如果您只想要一切,它将变得更加容易:
compile group: 'org.boofcv', name: "all", version: '0.19-SNAPSHOT'
so it will be something like this: 所以会是这样的:
compile "org.boofcv:boofcv-android:0.27"
as mentioned in this page , to avoid library conflict add this to app.gradle: 如本页所述 ,为避免库冲突,请将其添加到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"
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.