不支持的方法:运行项目时,AndroidProject.getPluginGeneration() [英] Unsupported method: AndroidProject.getPluginGeneration() while running project
问题描述
我正在尝试使用Android Studio 2.2运行我的项目,但出现此错误
I'm trying to run my Project with Android Studio 2.2 but I get this error
Unsupported method: AndroidProject.getPluginGeneration().
The version of Gradle you connect to does not support that method.
我正在使用ButterKnife 8.4.0
I am using ButterKnife 8.4.0
我的应用gradle.file:
My app gradle.file:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
}
}
我的模块gradle文件:
My module gradle file:
apply plugin: 'com.android.application'
apply plugin: 'android-apt'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "xxx.xx"
minSdkVersion 10
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
}
dependencies {
compile 'com.jakewharton:butterknife:8.4.0'
apt 'com.jakewharton:butterknife-compiler:8.4.0'
}
为什么它不起作用,我该如何解决?
Why does it not work and how do I solve it?
推荐答案
一般问题:-
之所以会发生,是因为AS正在检查即时运行功能的可用性.解决方法是禁用即时运行":
It can occur because AS was checking availability of the Instant Run feature. The fixed is to disable Instant Run:
Windows& Linux:
File -> Settings -> Build, Execution, Deployment -> Instant Run.
Mac:
Android Studio -> Preferences -> Build, Execution, Deployment -> Instant Run.
感谢@pophus提及这一点.
Thanks to @pophus for mentioning this.
使用此步骤如果您使用的是黄油刀:-
如果您使用的是2.2.0或更高版本的新Jack编译器,则不需要'android-apt'插件,而是可以在声明编译器依赖项时将apt替换为注解处理器.
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.
也就是说,删除
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
从主要gradle文件中获取
from your main gradle file
然后删除
apply plugin: 'android-apt'
从您的主模块文件
并替换
apt 'com.jakewharton:butterknife-compiler:8.4.0'
使用
annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'
这篇关于不支持的方法:运行项目时,AndroidProject.getPluginGeneration()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!