4

I got the following error message when I was importing a project from github:

Failed to refresh Gradle project 'XXX' The project is using an unsupported version of the Android Gradle plug-in. Fix plug-in version and re-import project

This is not a duplicate of this because your get thee error message before

gradle/wrapper/gradle-wrapper.properties

is generated.

Community
  • 1
  • 1
quinestor
  • 1,432
  • 4
  • 19
  • 40
  • Did you try opening it up in eclipse? There are several issues importing stuff from eclipse to Android Studio. The git code *may* have been written in eclipse. – Ranveer Feb 17 '14 at 15:30

2 Answers2

1

The problem appeared after updates. The updated Android Gradle plug-in did not support the outdated version of Gradle I had. But the error message is misleading, if you don't attempt different build options you won't see what the problem is.

After downloading a newer version of Gradle, Imported the project again, then:

Use local gradle distribution

Then Gradle home set to the folder where the new version of gradle was downloaded

that solved it

Edit: From Scott (below comments) : It's preferable to use the wrapper and to change the Gradle version in gradle-wrapper.properties instead of downloading and installing Gradle yourself. As for the Android-Gradle plugin, that's set in the dependencies.classpath block in your build file; see this

Community
  • 1
  • 1
quinestor
  • 1,432
  • 4
  • 19
  • 40
  • 2
    It's preferable to use the wrapper and to change the Gradle version in gradle-wrapper.properties instead of downloading and installing Gradle yourself. As for the Android-Gradle plugin, that's set in the `dependencies.classpath` block in your build file; see http://stackoverflow.com/questions/21441204/gradle-error-in-android-studio-0-4-3/21441633#21441633 – Scott Barta Feb 18 '14 at 21:46
  • The key thing was updating the dependencies.classpath as Scott says. – rfay Dec 07 '14 at 23:41
0

I get this gradle-errors in 4 Studio updates! My solution: I copy the Studio-folder, and if gralde throws an error, I copy the old version back. It's not a good way, but until google is not able to deliver an update without producing always the same errors (even if mentioned in many forums), I stay on 4.9 and wait for the first final release.

Martin
  • 506
  • 1
  • 5
  • 12