Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

android

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
}
like image 447
Luiz Henrique Ugliano Avatar asked Jan 03 '16 01:01

Luiz Henrique Ugliano


2 Answers

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)

like image 108
Nick Cardoso Avatar answered Oct 21 '22 03:10

Nick Cardoso


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.

like image 26
piotrek1543 Avatar answered Oct 21 '22 02:10

piotrek1543