Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio plugin is too old

I was syncing fine and then suddenly when I tried to run a test on a device from Android Studio I started getting the error:

Error:(1, 0) Plugin is too old, please update to a more recent version, or set ANDROID_DAILY_OVERRIDE environment variable ...

I've looked around and I found from the gradle website that the latest version is 2.10, I tried adding that to my dependencies with no luck. I've tried various version numbers with various errors like the following:

Could not find com.android.tools.build:gradle:2.1
Searched in the following locations ...

I understand from all the searching I've done that its clearly a wrong version of gradle - but what IS the current version label I should be using, and how do I know it is installed on my machine ? I've always kept Android Studio updated.

So I currently have in the build.gradle:

    dependencies {
    classpath 'com.android.tools.build:gradle:2.0.0-alpha1'
}
like image 466
yoyoma Avatar asked Dec 30 '15 15:12

yoyoma


4 Answers

UPDATED (28/03/2017):

2.4.0-alpha3 is the latest release

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

Check https://bintray.com/android/android-tools/com.android.tools.build.gradle/view for the latest gradle versions.


2.0.0-alpha1 is on the Canary channel and apparently these releases come with an expiry date. 2.0.0-alpha3 is the latest release. Switch to

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

and you should be fine. Keep checking http://tools.android.com/tech-docs/new-build-system to know the latest releases.

You might run into some Dex error. I had to do Build > Clean Project once to get it to work.

like image 120
Sasank Mukkamala Avatar answered Nov 01 '22 12:11

Sasank Mukkamala


Change your existing configuration with this

  1. In your project view, select Gradle Scripts

  2. Open gradle-wrapper.properties

  3. Change this line:

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

with

     distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip
  1. Go to build.gradle (Project: your_app_name)

  2. Change this line

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

to this

     classpath 'com.android.tools.build:gradle:1.5.0'
  1. Don't click Sync Now
  2. From menu choose File -> Invalidate Caches/Restart...
  3. Choose first option: Invalidate and Restart

Android Studio would restart. After this, it should work normally

Hope it help

like image 22
piotrek1543 Avatar answered Nov 01 '22 13:11

piotrek1543


Now com.android.tools.build:gradle:2.0.0-alpha3 is old use this

 com.android.tools.build:gradle:2.0.0-beta2
like image 31
Asthme Avatar answered Nov 01 '22 11:11

Asthme


If your having trouble getting the plugin to resolve. Check that your including jcenter() (Jcenter) in your repositories for the buildscript. Google does not publish the plugin to mavenCentral() (Maven Central).

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

As others have mentioned the latest ATM is 2.0.0-alpha3 but that could change at any time. Here is the source of truth on the latest available version: https://jcenter.bintray.com/com/android/tools/build/gradle

As for the actual error here is the best answer is in is link. TLDR, undocumented feature of the non release plugins is they expire and you have to update. https://stackoverflow.com/a/31293869/873237

like image 39
JBirdVegas Avatar answered Nov 01 '22 13:11

JBirdVegas