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

AndroidAndroid StudioGradleAndroid Gradle-Plugin

Android Problem Overview


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

Android Solutions


Solution 1 - Android

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.

Solution 2 - Android

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

Solution 3 - Android

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.

Solution 4 - Android

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 <your-value-on-error-message>

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/

Solution 5 - Android

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.

Solution 6 - Android

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

Solution 7 - Android

Check the latest version of Gradle Plugin Here:

[ ![Download] 1]2

You should change this in dependencies of app settings

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

}

Solution 8 - Android

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

Solution 9 - Android

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.

Solution 10 - Android

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'

Solution 11 - Android

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

Solution 12 - Android

set Environment variable ANDROID_DAILY_OVERRIDE to same value Example - b9471da4f76e0d1a88d41a072922b1e0c257745c

this works for me.

Solution 13 - Android

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'.

Solution 14 - Android

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 :)

Solution 15 - Android

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'

Solution 16 - Android

the output is from NonFinalPluginExpiry.java

example 2.4.0-alpha7

https://github.com/c3ph3us/android-gradle-plugin-source-codes/blob/master/gradle-2.4.0-alpha7-sources/com/android/build/gradle/internal/NonFinalPluginExpiry.java

if someone want to use plugin and dont want to do a daily google shi..

either need to:

  1. recompile plugin

  2. replace "Plugin-Version" in manifest

  3. make a automation script to generate env var and set it daily

          MessageDigest crypt = MessageDigest.getInstance("SHA-1");
          crypt.reset();
          crypt.update(String.format(
                          "%1$s:%2$s:%3$s",
                             now.getYear(),
                             now.getMonthValue() -1,
                             now.getDayOfMonth())
                             .getBytes("utf8"));
         String overrideValue = new BigInteger(1, crypt.digest()).toString(16);
    

EXAMPLE APP IN JAVA (sources + JAR):

  1. FOR GENERATE ADO - for ALL OS'es WITH JVM
  2. SET ENV for LINUX

https://github.com/c3ph3us/ado

https://github.com/c3ph3us/ado/releases

example bash function to export env and start idea / or studio:

// eval export & start idea :) 
function sti() {
    export `java -jar AndroidDailyOverride.jar p`
    idea.sh
}

Solution 17 - Android

This is android's way of telling you to upgrade gradle to the most recent version. You can do two things-

  1. Upgrade to the newer version of gradle. You may face new errors after the upgrade (eg, if you are upgrading to 4.1, you will have to adapt to new syntax - "compile" is no longer valid, use "implementation").
  2. Update your ANDROID_DAILY_OVERRIDE variable to the value given. Go to Computer -> Properties -> Advanced System Settings -> Environment Variables, and create a new variable or update value of existing ANDROID_DAILY_OVERRIDE. As the name suggests, this value is only valid for one day and next day you will again have to override the variable.

Solution 18 - Android

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.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionMario NoratoView Question on Stackoverflow
Solution 1 - AndroidJared BurrowsView Answer on Stackoverflow
Solution 2 - AndroidSergioLucasView Answer on Stackoverflow
Solution 3 - Androiduser719662View Answer on Stackoverflow
Solution 4 - AndroidFelipe DuarteView Answer on Stackoverflow
Solution 5 - AndroidIgorGanapolskyView Answer on Stackoverflow
Solution 6 - AndroidVictor MwendaView Answer on Stackoverflow
Solution 7 - AndroidDinesh SunnyView Answer on Stackoverflow
Solution 8 - AndroidNarutoView Answer on Stackoverflow
Solution 9 - AndroidPeter ZhaoView Answer on Stackoverflow
Solution 10 - AndroidhugoView Answer on Stackoverflow
Solution 11 - AndroidNick CardosoView Answer on Stackoverflow
Solution 12 - AndroidVirendraView Answer on Stackoverflow
Solution 13 - AndroidashoykhView Answer on Stackoverflow
Solution 14 - AndroidGuillaume GendreView Answer on Stackoverflow
Solution 15 - Androiduser3326676View Answer on Stackoverflow
Solution 16 - Androidceph3usView Answer on Stackoverflow
Solution 17 - Androidkshubham07View Answer on Stackoverflow
Solution 18 - AndroidAshish srivastavaView Answer on Stackoverflow