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
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
either need to:
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):
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
}
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.
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.
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'.
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
This is android's way of telling you to upgrade gradle to the most recent version. You can do two things-