0

我是 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'])
                 }
4

3 回答 3

3

正如您项目 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-05-21T14:31:04.560 回答
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'
于 2015-06-21T14:13:31.293 回答
0
  1. 从此页面获取最新版本 https://boofcv.org/index.php?title=Download
  2. 使用此网站将 maven 转换为 gradle,并确保将 artifactId 更改为 boofcv-android: http ://sagioto.github.io/maven2gradle

所以它会是这样的:

compile "org.boofcv:boofcv-android:0.27"

本页所述,为避免库冲突,请将其添加到 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"
}
于 2017-10-10T05:44:23.543 回答