错误:无法找到方法' com.android.build.gradle.api.BaseVariant.getOutputs()Ljava / util / List;'。 此意外错误的可能原因包括:
在Android studio 3.0中就这个问题,使用JakeWharton伟大的上帝刀。请问如何处理这个问题,这对Android studio 2.3来说没问题。可能是我用错了方法,请指教,原来是用8.5.1版本,出错了,我升级到8.6.0,发现问题无法解决。
buildscript {
repositories {
jcenter()
mavenCentral()
maven {
url "https://jitpack.io"
}
maven {
url 'https://maven.google.com'
}
maven {
url 'https://dl.google.com/dl/android/maven2/'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-alpha4'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'org.greenrobot:greendao-gradle-plugin:3.2.1+'
classpath 'com.jakewharton:butterknife-gradle-plugin:8.6.0'
classpath ("com.tencent.mm:AndResGuard-gradle-plugin:1.2.3") { changing=true }
classpath 'com.letv.sarrsdesktop:BlockCanaryExPlugin:0.9.8.3'
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
maven {
url "https://jitpack.io"
}
maven {
url 'http://www.idescout.com/maven/repo/'
}
maven {
url "http://repo.baichuan-android.taobao.com/content/groups/BaichuanRepositories"
}
maven {
url 'https://maven.google.com'
}
maven {
url 'https://dl.google.com/dl/android/maven2/'
}
}
}
configurations {
all*.exclude group: 'com.android.support', module: 'support-v4'
}
task printProps << {
println commandLineProjectProp
println gradlePropertiesProp
println systemProjectProp
println envProjectProp
println System.properties['system']
}
apply plugin: 'com.android.application'
//butterknife
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'com.jakewharton.butterknife'
/**
* library
*/
dependencies {
compile 'com.jakewharton:butterknife:8.6.0+'
apt 'com.jakewharton:butterknife-compiler:8.6.0+'
}
答案 0 :(得分:5)
将butterknife-gradle-plugin降级为8.4或使用9.0快照。
答案 1 :(得分:2)
只需删除
即可
.offcanvas-siderbars
将classpath 'me.tatarka:gradle-retrolambda:3.7.0'
版本降级为butterknife
8.4.0
不要忘记删除下面的行
classpath 'com.jakewharton:butterknife-gradle-plugin:8.4.0'
答案 2 :(得分:2)
在我的图书馆项目中,此评论帮助了我(R2导入): https://github.com/JakeWharton/butterknife/issues/963#issuecomment-342547601
project&#39; build.gradle:
buildscript {
repositories {
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
google()
jcenter()
}
dependencies {
classpath 'com.jakewharton:butterknife-gradle-plugin:9.0.0-SNAPSHOT'
}
}
repositories {
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}
module&build; build.gradle:
apply plugin: 'com.jakewharton.butterknife'
...
dependencies {
compile 'com.jakewharton:butterknife:9.0.0-SNAPSHOT'
kapt 'com.jakewharton:butterknife-compiler:9.0.0-SNAPSHOT'
}
这样你可以使用
apply plugin: 'com.jakewharton.butterknife'