UnsupportedMethodException 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
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
文件并删除:
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'
现在应该可以正常工作
这篇关于UnsupportedMethodException Android Studio 2.2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!