java.lang.RuntimeException: Annotation processors must be explicitly declared now.

Android Studio升级到最新版3.0 Canary 8后,当使用到注解时,报了如下错误:
Error:Execution failed for task ':app:javaPreCompileDebug'. > Annotation processors must be explicitly declared now. The following dependencies on the compile classpath are found to contain annotation processor. Please add them to the annotationProcessor configuration

解决办法:在Gradle中添加如下代码
android {
    ...
    
    defaultConfig {
        ...

        javaCompileOptions { 
            annotationProcessorOptions { 
                includeCompileClasspath = true 
            } 
        }
    }
    
    ...
}

且保证多module只有一个依赖了butterknife注解库

 

posted on 2019-02-22 14:09  天凉才是好个秋  阅读(1957)  评论(0编辑  收藏  举报

导航