不支持的方法异常 Android Studio 2.2 [英] UnsupportedMethodException Android Studio 2.2
问题描述
我将我的 android studio 更新到 2.2.现在,当我打开并运行以前的项目时,出现错误 UnsupportedMethodException.
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
.
推荐答案
这里有一些解决您问题的方法.禁用Instant run
应该就够了
Here are some solutions for your problem. Disabling Instant run
should be enough
转到您的 build.gradle
文件并将 gradle-plugin 版本更改为:
Go to your build.gradle
file and change gradle-plugin version to:
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0'
}
即时运行
这是由 Android Studio
检查 Instant Run 功能的可用性引起的.
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.
和取消选中所有位置
这个问题也可能是因为使用了这个插件.
This problem may be caused also by using this plugin.
我想在这个例子中你正在使用 Butterknife
库.....
I suppose for this example that you're using Butterknife
library.....
注意:如果您使用的是版本 2.2.0
的新 Jack
编译器或更新,你不需要 'android-apt'
插件,而是可以声明编译器时用 annotationProcessor
替换 apt依赖.
NOTE: If you are using the new
Jack
compiler with version2.2.0
or newer, you do not need the'android-apt'
plugin and can instead replace apt withannotationProcessor
when declaring the compiler dependency.
转到您的 build.gradle
文件并删除:
Go to your build.gradle
file and remove:
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
然后转到您的 app/build.gradle
文件并删除:
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'
与
annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'
现在应该可以了
这篇关于不支持的方法异常 Android Studio 2.2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!