71

I updated the Android Studio version 2.0 and was using normally. When I created a new project today, it is displaying the error Plugin is too old, please update to a more recent version, or set ANDROID_DAILY_OVERRIDE environment variable to

I realized that this problem occurs only when I create a new project. In previous projects developed, the problem does not occur and I realized that gradle is different classpath 'com.android.tools.build:gradle:1.3.0'.

I have to update with the same set of old projects?

My app/build.gradle

apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "23.0.2"

defaultConfig {
    applicationId "luizugliano.com.br.teste"
    minSdkVersion 16
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
  }
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
}

My build.gradle (Project)

// Top-level build file where you can add configuration options common to all    sub-projects/modules.

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

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

allprojects {
  repositories {
    jcenter()
  }
}

task clean(type: Delete) {
  delete rootProject.buildDir
}
piotrek1543
  • 19,130
  • 7
  • 81
  • 94
Luiz Henrique Ugliano
  • 1,317
  • 2
  • 13
  • 26
  • check your gradle version and set gradle version what you installed. – Prathap Badavath Jan 03 '16 at 01:33
  • 3
    Possible duplicate of [Plugin is too old, please update to a more recent version, or set ANDROID\_DAILY\_OVERRIDE environment variable to](http://stackoverflow.com/questions/29063968/plugin-is-too-old-please-update-to-a-more-recent-version-or-set-android-daily) – igorepst Jan 11 '16 at 07:12
  • have you tried install the newest android studio from release channel? – yfsx Apr 26 '16 at 09:53

17 Answers17

130

UH OH, Google Notice: "This website no longer provides downloads for Android Studio."

(Old 'channel' links no longer work. Links in this answer have been updated to the new formats, make sure to change your bookmarks if you were using them)

You need to update the version of the gradle tools you are building with. This can be found inside the dependencies section of your build.gradle. You have 3 options you can update to:

The latest stable version referenced in the release channel as of 2nd March, 2017 is

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

Or the latest beta version via preview channel as of 15th February, 2017 is

classpath 'com.android.tools.build:gradle:2.3.0-beta4'

And the latest alpha version also from the preview channel as of 21st March, 2017 gives you the option to use

classpath 'com.android.tools.build:gradle:2.4.0-alpha3' 

Updating requires you to also upgrade the gradle wrapper. As of 20th February '17, the newest is:

distributionUrl=https\://services.gradle.org/distributions/gradle-3.4-all.zip

On android studio you can find your wrapper by changing to the project view and looking in gradle/wrapper/gradle-wrapper.properties

Sometimes after changing wrapper the project will fail to compile with an error like “Minimum supported Gradle version is 2.14.1. Current version is 2.10. Try changing Gradle distribution version to...” despite already having the correct version in gradle-wrapper.properties. If that happens try the following:

Go to Settings > Build, Execution, Deployment > Gradle

Under Project-level settings ensure that Use default gradle wrapper (recommended) is the selected option, then re-build your project.

(Additional Note: With regards to the alpha and beta versions - there is not always a newer build than the stable version when I check, in those cases I've just given values for the previous version. This allows you to roll back to that version if you experience issues with the released version)

Community
  • 1
  • 1
Nick Cardoso
  • 20,807
  • 14
  • 73
  • 124
  • How to find classpath for new version? – Vivek Ji Mar 01 '16 at 17:54
  • 1
    To add classpath 'com.android.tools.build:gradle:2.0.0-beta6' is enough. Android Studio will take care of the rest. – Jan Seevers Mar 13 '16 at 08:42
  • 1
    I used to have 'com.android.tools.build:gradle:2.0.0-beta6' but after changing it to beta7, it worked! I don't know why, especially since I did not change the Studio settings. Beware Droiders! – The Original Android Apr 08 '16 at 00:48
  • 1
    Yes, the old beta versions get deprecated pretty fast, thats why ive been trying to keep this answer up to date seeing as the question is getting a lot of traffic – Nick Cardoso Apr 09 '16 at 17:54
  • If you are not switching to stable, they have a 2.1 beta now, I'll update my answer – Nick Cardoso Apr 26 '16 at 08:04
  • 1
    Moving from 2.0.0-beta7 to com.android.tools.build:gradle:2.1.0-rc1 worked for me – SleepingLlama Apr 27 '16 at 17:11
  • kindly update the latest distribution url, as of 06-Aug-16 it is `distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip` – Atif Farrukh Aug 06 '16 at 08:23
  • Well it's not required to upgrade the distribution to work, but I can change it. Where did you find the latest version? – Nick Cardoso Aug 08 '16 at 12:59
  • @NickCardoso sorry i didn't any notification about your comment. I had to change my distribution, I am not sure why but I had to, I found it here https://services.gradle.org/distributions – Atif Farrukh Aug 11 '16 at 07:40
  • @NickCardoso I had a problem, when I try to change distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip by distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip, I think that nothing was changed, I had this following error : Error:Minimum supported Gradle version is 2.14.1. Current version is 2.10. If using the gradle wrapper, try editing the distributionUrl in /Users/Tai/PersonnalProject/tibears/mobile/android/gradle/wrapper/gradle-wrapper.properties to gradle-2.14.1-all.zip – Tai Nguyen Aug 28 '16 at 13:37
  • Did you try clearing android studios cache and doing a gradle clean? – Nick Cardoso Aug 29 '16 at 07:16
  • classpath 'com.android.tools.build:gradle:2.2.0-beta' causing problem ( runnuing new project on Android studio 2.2 ) Thanks @Nick Cardoso – TheFlash Oct 05 '16 at 06:05
  • Now gradle plugin 2.3.0-alpha2 also old old already, need to update to classpath 'com.android.tools.build:gradle:2.3.0-alpha2', here is the link to check the latest version https://jcenter.bintray.com/com/android/tools/build/gradle/. Cradle version 2.14.1also cannot use anymore, need to update to distributionUrl=https\://services.gradle.org/distributions/g‌​radle-3.2.1-all.zip, Here is the link to check the latest version, https://gradle.org/gradle-download/. – Weidian Huang Jan 01 '17 at 12:16
  • After updating to `com.android.tools.build:gradle:2.3.0-beta1` the `Theme.AppCompat.Light.NoActionBar` stopped working. Any thoughts? – Lennon Spirlandelli Jan 17 '17 at 21:00
26

In new project change this part:

dependencies {
    classpath 'com.android.tools.build:gradle:2.0.0-alpha1'

with

dependencies {
    classpath 'com.android.tools.build:gradle:1.5.0'.

If you're not experienced user, please stick with Android Studio's Updates Stable Channel. I suppose you got Android Studio from Canary Channel.

Note that:

The Canary Channel for Android Studio delivers the bleeding edge updates on a roughly weekly basis. While these builds do get tested, they are still subject to bugs, as we want people to see what's new as soon as possible.

From: http://tools.android.com/download/studio/canary

You don't need to change dependencies of your older projects. They should run normally on the latest version.

Community
  • 1
  • 1
piotrek1543
  • 19,130
  • 7
  • 81
  • 94
  • I got this error from the package at the bottom of this page: http://developer.android.com/sdk/index.html Would have expected this to be a stable branch package. – dataduck Feb 22 '16 at 10:33
  • 2
    I don't think this is an adequate answer, because official Google documentation list a `2.0.0-{alpha|beta}X` dependency, and reverting to a `1.X` version may make those features unsusable. – Marc L'Heureux Mar 21 '16 at 18:27
12

Same problem on update. this Fixed it for me:[build.gradle]

    classpath 'com.android.tools.build:gradle:2.0.0-alpha3'

or

    classpath 'com.android.tools.build:gradle:2.0.0-beta2'
SonniE
  • 131
  • 4
  • 4
    @shashi2459 In my situation, gradle `2.8`, built tool `23.0.2`, downgrade `com.android.tools.build:gradle:2.0.0-alpha3` to `com.android.tools.build:gradle:1.5.0` then it fiexd, take a try – Ninja Jan 25 '16 at 09:53
  • 1
    Just to add to this: I had to change my dependency to `com.android.tools.build:gradle:2.0.0-beta2` to get it to work. – Darwind Feb 07 '16 at 18:44
  • 1
    @Darwind, Thanks. I confirmed `beta2`(and not `alpha3`) works as of this writing. –  Feb 23 '16 at 19:44
7

Just in Advanced System Settings in Windows Properties, add a new environment variable with the name ANDROID_DAILY_OVERRIDE and the given value in error message. Restart android studio and you will be ready to go

enter image description here

Luka Kerr
  • 4,161
  • 7
  • 39
  • 50
fatih
  • 183
  • 1
  • 9
5

As of April 5, 2016 this worked for me:

classpath 'com.android.tools.build:gradle:2.0.0-rc3'
j2abro
  • 733
  • 8
  • 17
3

gradle version you need became

classpath 'com.android.tools.build:gradle:2.0.0-beta7'

Which requires you to use the gradle wrapper for 2.10 if you were still using previous version

distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip

On android studio you can find your wrapper by changing to the project view and looking in gradle/wrapper/gradle-wrapper.properties

Muhammad Waleed
  • 2,517
  • 4
  • 27
  • 75
Phani varma
  • 475
  • 5
  • 7
2
classpath: com.android.tools.build:gradle:+

This will solve the problem by updating gradle to latest one.

However it is dangerous(will code in alpha stage) & will also give warnings.

Sanyam Jain
  • 2,925
  • 2
  • 23
  • 30
2

If you are using Android Studio 2.0 Preview I can suggest using 'beta' updates channel instead of 'stable'. It will allow you to receive latest gradle configuration changes. You can change updates channel in Settings - Appearance & Behavior - System Settings - Updates. Select Automatically check updates for [Beta Channel]

In order to know actual version of gradle classpath and distributionUrl (check Nick Caroso's answer) you can create new empty project and see these values there.

Community
  • 1
  • 1
Artem M
  • 1,026
  • 14
  • 24
1

You need to change your gradle-wrapper.properties file in gradle/wrapper folder of your app, change your distributionUrl as this:

distributionUrl=http\://services.gradle.org/distributions/gradle-2.8-all.zip

Use http: or https:\ as per your requirement. Then just clean your project and you are done!!!

Side Note :

classpath 'com.android.tools.build:gradle:2.0.0-alpha3'

is available now, if you want to use latest version.

Also you can take advantage of instant run feature of android studio using this, which is not available in gradle version below 2.0.0

1

Android Studio 2.0 has an update project to use instant-run. For those like me with little brains:

http://tools.android.com/tech-docs/instant-run

The current version of Android Studio 2.0 is Beta 6.

fishjd
  • 1,617
  • 1
  • 18
  • 31
1

try update gradle to 2.10

for mac, tha path is Android Studio > Preferences > Builds,Execution,Deployment > Build Tools > Gradle

of course you must download gradle 2.10 before

yfsx
  • 1,906
  • 14
  • 17
1

I got the same error on 04/07/2016 with 'com.android.tools.build:gradle:2.2.0-alpha2' and gradle wrapper 2.10 then, I just changed to

'com.android.tools.build:gradle:2.2.0-alpha3'

now I have no problems.

Hope this help peple.

Vrian7
  • 588
  • 2
  • 6
  • 14
1

I have resolved this way.

Steps:

  1. Open gradle-wrapper.properties file and change distributionUrl to https\://services.gradle.org/distributions/gradle-2.14.1-all.zip.
  2. Open root level build.gradle and change classpath to com.android.tools.build:gradle:2.2.2.
  3. Sync your Android studio project.

Reference screen shot:

enter image description here

Done.

Hiren Patel
  • 52,124
  • 21
  • 173
  • 151
0

just change classpath 'com.android.tools.build:gradle:2.0.0-alpha ' or

classpath 'com.android.tools.build:gradle:2.1.0'
Abolfazl Miadian
  • 3,099
  • 2
  • 19
  • 15
0

I change my classpath from 'com.android.tools.build:gradle:2.2.0-alpha4'

to classpath 'com.android.tools.build:gradle:2.2.0-alpha5'

and clicked "try_again" when the warning appears "unable to find cached classpath" you just click "sync", this worked like a breeze.

joe
  • 11
  • 2
0

This problem occures generally when the IDE(android studio) in which project is build and the project are not in compatible gradle plug in. Please check the link below http://tools.android.com/tech-docs/new-build-system/version-compatibility

In my case i had created a project using AS 1.0/2.0 version, and later imported in studio version new it gave me error then I opened project in older version of AS it worked. you can also check http://tools.android.com/tech-docs/new-build-system

maruti060385
  • 707
  • 8
  • 11
0

File -> Project Structure -> Project -> Android Plugin version = 2.2.3

Working fine of Android Studio 2.2.3

Android Dev
  • 1,496
  • 1
  • 13
  • 25