Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unsupported method: InstantRun.getRestartDexFile() - Android Studio

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.

like image 477
d02d33pak Avatar asked Apr 16 '16 09:04

d02d33pak


3 Answers

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

like image 121
d02d33pak Avatar answered Oct 04 '22 00:10

d02d33pak


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.

like image 37
Waylan Punch Avatar answered Oct 04 '22 01:10

Waylan Punch


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'
like image 33
phongnt Avatar answered Oct 04 '22 02:10

phongnt