studio3.0Butterknife使用及报错解决

第一步添加依赖

implementation 'com.jakewharton:butterknife:8.8.1'
implementation 'com.jakewharton:butterknife-compiler:8.8.1'

使用就是这样
接下来是解决报错

Annotation processors must be explicitly declared now.
The following dependenciesonthe compile classpath are found tocontain annotation processor.
Please add themtothe annotationProcessor configuration. - butterknife-7.0.1.jar Alternatively,
set android.defaultConfig.javaCompileOptions.annotationProcessorOptions.includeCompileClasspath =truetocontinuewith previous behavior. 
Notethat this option is deprecated and will be removed inthe future.

解决方法
在module的build.gradle中添加如下代码
需要添加在Android目录下的defaultconfig中添加

javaCompileOptions {
    annotationProcessorOptions {
        includeCompileClasspath = true
    }
}

你可能感兴趣的:(知识点,第三方集成)