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注解库

 

猜你喜欢

转载自www.cnblogs.com/evolutionoflicorice/p/10418052.html