如何解决插件太旧,请更新到最新版本,或将 ANDROID_DAILY_OVERRIDE 环境变量设置为?

就像 CommonsWare 建议的那样,确保你有 Gradle 2.2.1+(最新的是 2.3)。

确保升级您的 Android Studio,但这里有需要更新的“插件”:

改变:

classpath 'com.android.tools.build:gradle:1.1.0-rc1'

至:

classpath 'com.android.tools.build:gradle:1.1.3' // latest 1.5.0

改变:

compile 'com.android.support:recyclerview-v7:21.0.0'
compile 'com.android.support:cardview-v7:21.0.0'

至:

compile 'com.android.support:recyclerview-v7:22.0.0' // latest 23.1.1
compile 'com.android.support:cardview-v7:22.0.0' // latest 23.1.1

摇篮:https ://gradle.org/downloads

始终检查 Android SDK 管理器以获取最新版本:

Android 构建工具插件http ://tools.android.com/tech-docs/new-build-
system

Android 支持库:http: //developer.android.com/tools/support-
library/features.html

要查看最新的插件版本,请直接查看 Bintray Jcenter
页面https ://bintray.com/android/android-
tools/com.android.tools.build.gradle/view 。

解决方法

今天我刚刚从 Android SDK 导入了一个示例应用程序作为我的项目(分析)中的一个模块,当我尝试同步它时突然出现这个 gradle
错误:Plugin is too old,please update to a more recent version,or set
ANDROID_DAILY_OVERRIDE envrinment variable to...

这是我的应用程序gradle文件:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.0"
    defaultConfig {
        applicationId "xxx.xxxxxx.xxxxx"
        versionCode 1
        versionName '1'
        minSdkVersion 9
        targetSdkVersion 22
        versionCode 1
        versionName '1'
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro'
        }
    }


    dependencies {
    compile fileTree(dir: 'libs',include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.0.0'
    compile 'com.google.android.gms:play-services:6.5.87'
    compile 'com.android.support:recyclerview-v7:21.0.0'
    compile 'com.android.support:cardview-v7:21.0.0'
    compile 'com.facebook.android:facebook-android-sdk:3.21.1'
    testCompile 'junit:junit:4.12'
    compile project(':volley')
}

您是否知道可能是哪个原因(我正在使用插件版本 1.1.0-rc1 以及gradle版本 2.2 和Android Studio版本 1.1.0)?

编辑:

这是我的上衣build.gradle

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.1.0-rc1'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}