gpt4 book ai didi

android - Android 中的 Gradle 错误

转载 作者:行者123 更新时间:2023-11-30 02:16:29 25 4
gpt4 key购买 nike

有人知道我错过了什么吗?我的程序在 5 分钟前运行并且知道我有这个奇怪的错误:

17:16:38 UnsupportedMethodException
Unsupported method: AndroidArtifactOutput.getOutputFile().
The version of Gradle you connect to does not support that method.
To resolve the problem you can change/upgrade the target version of Gradle you connect to.
Alternatively, you can ignore this exception and read other information from the model.: Unsupported method: AndroidArtifactOutput.getOutputFile().
The version of Gradle you connect to does not support that method.
To resolve the problem you can change/upgrade the target version of Gradle you connect to.
Alternatively, you can ignore this exception and read other information from the model.

我不能忽略它,因为我不能再在我的 android 设备上运行它了,有人吗?

Build.gradle 文件:

apply plugin: 'com.android.application'

android {
compileSdkVersion 21
buildToolsVersion "20.0.0"

defaultConfig {
applicationId "com.example.test.google_maps_task_1"
minSdkVersion 11
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile 'com.google.android.gms:play-services:4.2.42'
compile 'com.android.support:appcompat-v7:21.+'
compile 'org.apache.httpcomponents:httpclient-android:4.3.5.1'

}

最佳答案

正如我所想,这里有许多过时的插件/工具。请试试这个修复和更新的 build.gradle:

此外,请确保您使用的是最新的构建插件:com.android.tools.build:gradle:1.1.3

apply plugin: 'com.android.application'

android {
compileSdkVersion 22 // <-- was 21
buildToolsVersion "22.0.1" // <-- was 20.0.0

defaultConfig {
applicationId "com.example.test.google_maps_task_1"
minSdkVersion 11
targetSdkVersion 22 // <-- was 21
versionCode 1
versionName "1.0"
}

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

dependencies {
compile 'com.google.android.gms:play-services:6.5.87' // <-- was 4.2.42
compile 'com.android.support:appcompat-v7:22.0.0' // <-- was 21.+
compile 'org.apache.httpcomponents:httpclient-android:4.3.5.1' // (the only up to date plugin you had)
}

关于android - Android 中的 Gradle 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29261028/

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