Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
339 views
in Technique[技术] by (71.8m points)

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

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
}
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...