奇怪的是,我在 Android Studio 中遇到了这个错误。以前没有发生过。据我所知,我可能需要将 gradle 版本更新为新版本。
Error:(1, 0) Plugin is too old, please update to a more recent version, or set ANDROID_DAILY_OVERRIDE environment variable to "xxxxxxxxxxx"
这是我的build.gradle(Project:My project name goes here)文件。
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0-alpha3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
和build.gradle(Module:app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "my project goes here"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
}
关于如何更新 gradle 版本有什么想法吗?
谢谢。
最佳答案
在最上面的build.gradle
classpath 'com.android.tools.build:gradle:1.3.0'
目前,您有一个正在使用的非官方 alpha 版本。切换到官方版本的某些部分。
您还应该在顶部 build.gradle 中控制您的构建工具和其他项目,而不是在模块构建文件中,如图所示。
将它放在您的顶级项目 gradle.build 中,因为如果没有它,您将无法确保所有模块都将被兼容地编译,现在您必须单独管理它。
ext {
compileSdkVersion = 23
buildToolsVersion = "23.0.1"
supportV4 = 'com.android.support:support-v4:21.0.3'
}
关于android - 插件太旧,请更新到较新的版本,或设置 ANDROID_DAILY_OVERIDE,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34951242/