Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio Unsupported Version of Gradle Plugin

Similar to the question asked here : Android Studio unsupported version of gradle but I'm using a compatible version , but the answer there does not fix the problem for me.

I am using Android Studio Beta 0.8.1 running under Ubuntu 14.04 LTS. I am trying to import a project which is shared with my team, but when I clone the project and attempt to build it, I get this error:

Error:The project is using an unsupported version of the Android Gradle
plug-in (0.11.2) <a href="fixGradleElements">Fix plug-in version and re-import
project</a>

When I click the link, I get this error:

12:21:30 PM Quick Fix Failed
         Unable to find any references to the Android Gradle plug-in in build.gradle files.
         Please click the link to perform a textual search and then update the build files manually.

Here is the relevant section of my build.gradle file:

buildscript {
  ...
  dependencies {
      classpath 'com.android.tools.build:gradle:0.11.+'
  } 
}

I have manually installed a recent version of Gradle in an attempt to rectify this problem (Ubuntu really only wants to let me have version 1.4, but our project is configured for Gradle 1.11+. Here is the output of "gradle -v":

------------------------------------------------------------
Gradle 1.11
------------------------------------------------------------

Build time:   2014-02-11 11:34:39 UTC
Build number: none
Revision:     a831fa866d46cbee94e61a09af15f9dd95987421

Groovy:       1.8.6
Ant:          Apache Ant(TM) version 1.9.2 compiled on July 8 2013
Ivy:          2.2.0
JVM:          1.8.0_05 (Oracle Corporation 25.5-b02)
OS:           Linux 3.13.0-30-generic amd64

I tried to set Android Studio to use the local Gradle installation (File > Settings > Gradle > Use local gradle distribution), but this only yields an error that a given task can't be found in the root project. (?)

When I build the project from the command line with the command "./gradlew clean assembleDebug", it builds perfectly and I am able to install and run the APK.

I don't understand what I'm doing wrong, or how to fix it. Any clues would be deeply appreciated!

like image 860
Patrick Brennan Avatar asked Jul 06 '14 19:07

Patrick Brennan


1 Answers

Android Studio 0.8.1 requires the gradle-plugin 0.12.

buildscript {
  ...
  dependencies {
      classpath 'com.android.tools.build:gradle:0.12.+'
  } 
}

Check this answer for compatibility:

Android Studio Gradle issue upgrading to version 0.5.0 - Gradle Migrating From 0.8 to 0.9 - Also Android Studio upgrade to 0.8.1

like image 166
Gabriele Mariotti Avatar answered Oct 07 '22 18:10

Gabriele Mariotti