Plugin is too old, please update to a more recent version, or set ANDROID_DAILY_OVERRIDE environment variable to

匿名 (未验证) 提交于 2019-12-03 02:56:01

问题:

today I just imported a sample app from Android SDK as a module in my project (analytics) and suddenly I got this gradle error when I try to sync it: Plugin is too old, please update to a more recent version, or set ANDROID_DAILY_OVERRIDE envrinment variable to...

This is my app gradle file:

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') }

Do you have any idea of which may be the cause (I'm using the plugin version 1.1.0-rc1 and the gradle version 2.2 and Android Studio version 1.1.0)?

EDIT:

This is my top 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()     } }

回答1:

Just like CommonsWare suggested, make sure you have Gradle 2.2.1+ (the latest is 2.3).

Make sure you upgrade your Android Studio but here are the "plugins" that need to be updated:

Top build.gradle:

Change:

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

To:

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

App build.gradle:

Change:

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

To:

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

Gradle: https://gradle.org/downloads

Always check the Android SDK Manager for the latest revisions:

Android Build Tools Plugin: http://tools.android.com/tech-docs/new-build-system

Android Support Libraries: http://developer.android.com/tools/support-library/features.html

To view the latest plugin releases, view the Bintray Jcenter page directly: https://bintray.com/android/android-tools/com.android.tools.build.gradle/view.



回答2:

Solution (Updated: 24-may-2016): Change build.gradle (project)

buildscript { repositories {     jcenter() } dependencies {     classpath 'com.android.tools.build:gradle:X.X.X-lastVersionGradle'     classpath 'com.google.gms:google-services:X.X.X-lastVersionGServices' // If use google-services      // NOTE: Do not place your application dependencies here; they belong     // in the individual module build.gradle files }

X.X.X-lastVersionGradle: For example: 2.1.0

X.X.X-lastVersionGServices: For example: 3.0.0 (support Firebase Analytics)

Note: if you're using the google-services plugin has to be the same version (if there)

Warning!! -> 2.2.0-alpha throws Unsupported major.minor version 52.0 if you don't use java JDK 8u91 and NetBeans 8.1



回答3:

As a side note, I have been getting the same error in completely unrelated situation - after my system clock year setting has been changed (i.e. 2015 -> 2016); changing the clock back to the correct one solved the issue.

Note 1: I'm posting this mainly because I had the exactly same error message, but the working solution proven to be different than just updating the plugin's version (as posted by Jared Burrows).

Note 2: using

classpath 'com.android.tools.build:gradle:+'

can make the plugin version default to newest one. Bear in mind that your build may break on API changes (and is, for that very reason, discouraged by Android API docs), so use this at your own risk only if you're constantly updating the version anyway.



回答4:

Just in case someone is struggling with this, in my case I'm using Gradle 1.4 beta 1 and I NEED to keep it. So in order to make Android Studio works go to the terminal and run this:

launchctl setenv ANDROID_DAILY_OVERRIDE

Restart Android Studio and the project will build again.

Kudos to UPDATE 2 here: https://emmanuelbernard.com/blog/2012/05/09/setting-global-variables-intellij/



回答5:

You can always check the latest gradle plugin version here: https://bintray.com/android/android-tools/com.android.tools.build.gradle

So as of today you should use:

classpath 'com.android.tools.build:gradle:2.2.2'

accordingly.



回答6:

Replace your class path with something ambiguous like this. Its a solution and it works but it may not be a good solution.

classpath 'com.android.tools.build:gradle:+'

The best way is replacing the + with the latest version of gradle



回答7:

Check the latest version of Gradle Plugin Here:

You should change this in dependencies of app settings

buildscript { repositories {     jcenter() } dependencies {     classpath 'com.android.tools.build:gradle:[PLACE VERSION CODE HERE]'  }

}



回答8:

This issue occurs because of the Gradle version changes, since your application uses old version of gradle, you need to update to new version.

This changes needs to be done in build.gradle file, have look at this link http://www.feelzdroid.com/2015/11/android-plugin-too-old-update-recent-version.html. to know how to update the gradle and detailed steps are provided. there.

Thans



回答9:

I'm using Android Data Binding and I have the same problem today.

To solve it, change:

classpath "com.android.databinding:dataBinder:1.0-rc0"

To:

classpath "com.android.databinding:dataBinder:1.0-rc1"

1.0-rc0 still could be found on jcenter now, I don't know why it couldn't be use.



回答10:

I got a way which finally resolve this 1. check your calsspath in the top build.gradle,e.g mine is classpath 'com.android.tools.build:gradle:2.1.0-alpha3' then go to https://jcenter.bintray.com/com/android/tools/build/gradle/ find a release which is newer than yours,here I choose 2.1.0-beta3 change classpath to below, then launch the build. classpath 'com.android.tools.build:gradle:2.1.0-beta3'



回答11:

If you want to continue to use the newest development versions then this problem can reoccur each time your version is far enough out of date.

I've been keeping an up-to-date list of the most current development versions as well as the stable version on my answer to this similar question, so that I can fix it each time I get a new warning:

Android Studio 2.0 - Plugin is too old, please update to a more recent version, or set ANDROID_DAILY_OVERRIDE



回答12:

set Environment variable ANDROID_DAILY_OVERRIDE to same value Example - b9471da4f76e0d1a88d41a072922b1e0c257745c

this works for me.



回答13:

The solution of removing the '-rcX' part works. I wanted to provide some more detail on why the error is happening. The issue is with https://android.googlesource.com/platform/tools/base/+/master/build-system/gradle/src/main/groovy/com/android/build/gradle/BasePlugin.java#230

There is a default 40 days 'retirement age' for plugins that don't have a version or contain 'rc', 'alpha', or 'beta'.



回答14:

In the past months, I used a "preview" version of Android Studio. I tried to switch back to the "stable" releases for the software updates but it wasn't enough and I got this famous error you talk of.

Uninstalling my Android Studio 2.2.preview and installing latest stable Android Studio (2.1) fixed it for me :)



回答15:

Go for stable version or gradle in app level gradle file in my case it was
classpath 'com.android.tools.build:gradle:2.2.0-alpha3'

I changed it with

classpath 'com.android.tools.build:gradle:2.1.2'



回答16:

You should upgrade the version of gradle. for example: com.android.build.gradle 1.3.0

this issue occurs when version of the gradle is changed.



易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!