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

后端 未结 18 809
再見小時候
再見小時候 2020-11-28 04: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

相关标签:
18条回答
  • 2020-11-28 04:26

    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
    }
    
    0 讨论(0)
  • 2020-11-28 04:27

    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.

    0 讨论(0)
  • 2020-11-28 04:28

    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.

    0 讨论(0)
  • 2020-11-28 04:28

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

    0 讨论(0)
  • 2020-11-28 04:30

    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

    0 讨论(0)
  • 2020-11-28 04:36

    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.
    0 讨论(0)
提交回复
热议问题