Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unsupported method: GradleProject.getBuildScript()

I am getting this error while importing an adt project(after exporting and creating gradle file) into Android Studio on mac os x.

The android-studio version is 3.6 (latest) and the gradle version is 1.8 (latest).

The error shows up as:

Unsupported method: GradleProject.getBuildScript(). The version of Gradle you connect to does not support that method. To resolve the problem you can change/upgrade the target version of Gradle you connect to. Alternatively, you can ignore this exception and read other information from the model.

Consult IDE log for more details (Help | Show Log)

I have no idea where to look for IDE logs...

like image 482
Anish Singh Avatar asked Nov 15 '13 17:11

Anish Singh


1 Answers

I was getting a similar error today opening a project after upgrading to Android Studio 0.3.6. Here is what I had to change to get it working again for me.

  • Changed the following line in gradle-wrapper.properties from gradle-1.6-bin.zip to gradle-1.8-bin.zip

distributionUrl=http://services.gradle.org/distributions/gradle-1.8-bin.zip

  • Also changed the following line in build.gradle from 0.5.+ to 0.6.+

classpath 'com.android.tools.build:gradle:0.6.+'

In Windows, gradle-wrapper.properties is located at \project folder\gradle\wrapper\gradle-wrapper.properties

build.gradle is located at \project folder\module folder\build.gradle

The Files that Needed changed are highlighted in the project explorer screen shot below.

Here's a screen shot of the project explorer in Android Studio with the files that need changed highlighted.

After those changes I sync'd the project with the gradle files and then could build and test.

Hope that helps.

Note that you should use default or customizable gradle wrapper: gradle idea settings

like image 152
LeftyCoder Avatar answered Jan 01 '23 21:01

LeftyCoder