Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UnsupportedMethodException Android Studio 2.2

I updated my android studio to 2.2.Now when I open and run previous project I got error UnsupportedMethodException.

Unsupported method: AndroidProject.getPluginGeneration().
             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

.

like image 535
Singh Avatar asked Sep 24 '16 11:09

Singh


3 Answers

Here are some solutions for your problem. Disabling Instant run should be enough

Gradle version:

Go to your build.gradle file and change gradle-plugin version to:

dependencies {
    classpath 'com.android.tools.build:gradle:2.2.0'
}

Instant Run

It is caused by Android Studio checking availability of the Instant Run feature.

Fix it by disabling Instant Run. Go to:

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

and uncheck all positions

Using android-apt plugin

This problem may be caused also by using this plugin.

I suppose for this example that you're using Butterknife library.....

NOTE: If you are using the new Jack compiler with version 2.2.0 or newer, you do not need the 'android-apt' plugin and can instead replace apt with annotationProcessor when declaring the compiler dependency.

Go to your build.gradle file and remove:

classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'

Then go to your app/build.gradle file and remove:

apply plugin: 'android-apt'

Then in the same file, replace existing:

apt 'com.jakewharton:butterknife-compiler:8.4.0'

with

annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'

It should work now

like image 149
piotrek1543 Avatar answered Oct 15 '22 03:10

piotrek1543


You are trying to import a gradle project built with a version not suppoted in your ide(Android Studio), try to rebuild your project with a compatible version from the command line first:

gradle wrapper --gradle-version 3.0

(3.0 is just an example, try to find out what version needs your IDE).

After this step the import process should be ok

like image 31
colo Avatar answered Oct 15 '22 05:10

colo


Update Gradle version to a higher version for me it starts working when I updated it to 2.10

like image 2
Mohit Avatar answered Oct 15 '22 05:10

Mohit