公司新開(kāi)一個(gè)項(xiàng)目,換個(gè)方式擼,本來(lái)沒(méi)準(zhǔn)備用butterknife。然而我高估了我的耐心。。。
然后又回到了butterknife,然而居然報(bào)錯(cuò)。。。什么???不可能啊,之前還沒(méi)問(wèn)題的啊。崩潰ing...
環(huán)境
Android studio 3.4.1
butterknife 8.8.1
classpath 'com.android.tools.build:gradle:3.4.2'
錯(cuò)誤日志
ERROR: Unable to find method 'com.android.build.gradle.api.BaseVariant.getOutputs()Ljava/util/List;'.
Possible causes for this unexpected error include:
Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)
The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
Stop Gradle build processes (requires restart)
Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.
In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.
最終解決方式
刪除 applyplugin:'com.jakewharton.butterknife'
改為
android {
...
defaultConfig {
......
javaCompileOptions {
// 顯式聲明支持注解
annotationProcessorOptions {
includeCompileClasspath true
}
}
}
}