當(dāng)Android studio 3.0+使用butterknife

公司新開(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
            }
        }
    }
}

over....

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

友情鏈接更多精彩內(nèi)容