gpt4 book ai didi

java - 为什么gradle会出错?

转载 作者:行者123 更新时间:2023-12-01 10:14:44 25 4
gpt4 key购买 nike

我尝试在我的项目中导入 OpenCV 模块。我找到了一些不错的教程并创建了新项目来测试 OpenCV 实现。问题,当我在新项目中导入 OpenCV 库时一切正常(教程 here )。

但是当我对现有项目进行相同的操作时,我收到了错误

enter image description here

我尝试修复它,但没有成功。我该如何修复它?

Gradle 文件

buildscript {
repositories {
jcenter()
}

dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
}
}

apply plugin: 'com.android.application'

repositories {
jcenter()
}

dependencies {
compile 'com.android.support:support-v4:23.2.0'
compile 'com.android.support:support-v13:23.2.0'
compile 'com.android.support:cardview-v7:23.2.0'
compile 'com.android.support:appcompat-v7:23.2.0'
compile files('libs/svgandroid.jar')
compile files('libs/svg-android.jar')
compile files('libs/guava-16.0.1.jar')
}

// The sample build uses multiple directories to
// keep boilerplate and common code separate from
// the main sample code.
List<String> dirs = [
'main', // main sample code; look here for the interesting stuff.
'common', // components that are reused by multiple samples
'template' // boilerplate code that is generated by the sample template process
]

android {
compileSdkVersion 23
buildToolsVersion "23.0.2"

defaultConfig {
minSdkVersion 22
targetSdkVersion 23
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}

sourceSets {
main {
dirs.each { dir ->
java.srcDirs "src/${dir}/java"
res.srcDirs "src/${dir}/res"
}
}
androidTest.setRoot('tests')
androidTest.java.srcDirs = ['tests/src']
}
}

最佳答案

最新 Gradle:2.11

检查:gradle -v

在这里下载:http://services.gradle.org/distributions/gradle-2.11-bin.zip

最新 Android 构建工具:1.5.0

如果将以下代码 fragment 添加到 build.gradle 文件的顶部,gradle 将更新构建工具。

buildscript {
repositories {
jcenter() // or mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
}
}

在此处了解更多信息:http://tools.android.com/tech-docs/new-build-system

关于java - 为什么gradle会出错?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35968917/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com