9

I have Android Studio 2.0 Beta 6
and the Gradle version in build.gradle is classpath 'com.android.tools.build:gradle:2.1.0-beta1'
(I updated it today only, earlier I was at gradle:2.0.0-alpha9).
Now when I try to Run my app I keep getting this Message.

UnsupportedMethodException
Unsupported method: InstantRun.getRestartDexFile().
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.
Alternatively, you can ignore this exception and read other information from the model.

Everything was running fine before the upgrade (including Instant Run).
Please help.

d02d33pak
  • 673
  • 3
  • 8
  • 22

6 Answers6

11

I am posting this as an answer because this solved the problem for me.
I changed the classpath in build.gradle to

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

I did not change anything else/any setting at all, neither did I updated my Android Studio.

Link to the page where I found it.
Had to search a lot. :)

Edit:
Alternatively as pointed out by others,
1. You can either try Upgrading Your Android Studio to 2.1.0 (OR)
2. You can try changing the classpath in build.gradle to

classpath 'com.android.tools.build:gradle:2.1.0

d02d33pak
  • 673
  • 3
  • 8
  • 22
5

I ran into the same exception

Alternatively, you can ignore this exception and read other information from the model.

It says there is an alternative solution, so what should we do to ignore this exception ?


OK, upgrading the Android Studio will solve the problem.

Waylan Punch
  • 239
  • 4
  • 17
1

I get the trouble on Android 2.1 preview 5.I changed the classpath in build.gradle to

   classpath 'com.android.tools.build:gradle:2.0.0'
phongnt
  • 711
  • 7
  • 13
0

update the studio to 2.1.0 , will solve your problem

rana
  • 1,824
  • 3
  • 21
  • 36
0

first i have android 2.1 and i have set enter image description here

then i have set enter image description here

i also getting that error Unsupported method: InstantRun.getRestartDexFile() - Android Studio then

Step 1

i have updated android to 2.2 and get that error Unsupported method: AndroidProject.getPluginGeneration() while running project to fix that issue do that

Step 2

refer link -Unsupported method: AndroidProject.getPluginGeneration() while running project disable instant run Windows & Linux:

Linux:

File -> Settings -> Build, Execution, Deployment -> Instant Run.

Mac:

Android Studio -> Preferences -> Build, Execution, Deployment -> Instant Run.

finally fixed all things and i have successfully run my project.

Community
  • 1
  • 1
damith
  • 33
  • 6
-1

The problem solved by using:

classpath 'com.android.tools.build:gradle:2.1.0-alpha3'
classpath 'com.google.gms:google-services:2.1.0-alpha3' 
NEXT
  • 101
  • 1
  • 7