gpt4 book ai didi

android - 该项目可能正在使用不包含方法 'compileSdkVersion()' 的 Gradle 版本

转载 作者:塔克拉玛干 更新时间:2023-11-01 21:20:38 27 4
gpt4 key购买 nike

我在尝试运行最初在 Eclipse ADT 上创建的项目时遇到了这个问题。

Error:(17, 0) Gradle DSL method not found: 'compileSdkVersion()'
Possible causes:<ul><li>The project 'TaxiAndroidOpen-master' may be using a version of Gradle that does not contain the method.
<a href="open.wrapper.file">Open Gradle wrapper file</a></li><li>The build file may be missing a Gradle plugin.
<a href="apply.gradle.plugin">Apply Gradle plugin</a></li>

我已经将其转换为 Android Studio gradle 系统。

但我无法运行它,也无法编译它,因为这个错误,这是生成的 gradle:

// Top-level build file where you can add configuration options common to  all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
}
}
allprojects {
repositories {
jcenter()
}
}

ext {
compileSdkVersion 17
buildToolsVersion '18.1.0'
}
dependencies {
}

我在 SO 上发现了其他一些帖子,有类似的错误,但没有人有这个特定的错误。

我使用的是 Android Studio 1.0.2,x86。

有人可以阐明这一点吗?

提前致谢!

编辑

更新的 build.gradle:

apply plugin: 'com.android.application'

android {
compileSdkVersion 17
buildToolsVersion "21.1.2"

defaultConfig {
applicationId "com.opentaxi.android"
minSdkVersion 9
targetSdkVersion 19
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}

dependencies {
compile project(':comtaxibulgariamap_mapsforge_044201406271417533')
compile files('libs/littlefluffylocationlibrary_r15.jar')
}

最佳答案

您的应用程序模块的 build.gradle 文件应如下所示。

apply plugin: 'com.android.application'

android {
compileSdkVersion 17
buildToolsVersion "21.1.2"

defaultConfig {
applicationId "com.opentaxi.android"
minSdkVersion 9
targetSdkVersion 19
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

}

dependencies {

compile project(':comtaxibulgariamap_mapsforge_044201406271417533')
compile fileTree(include: ['*.jar'], dir: 'libs')
}

并从您的主 bu​​ild.gradle(在应用程序的根目录中)中删除这些行(如果它在您发布时存在)。

  ext {
compileSdkVersion 17
buildToolsVersion '18.1.0'
}
dependencies {
}

关于android - 该项目可能正在使用不包含方法 'compileSdkVersion()' 的 Gradle 版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28547154/

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