Butterknife+kotlin出现的坑

正常引用Butterknife

在module的build文件中

implementation "com.jakewharton:butterknife:10.0.0"
annotationProcessor "com.jakewharton:butterknife-compiler:10.0.0"

编译运行无效,

Butterknife的文档里有这么一句话:

If you are using Kotlin, replace annotationProcessor with kapt.

所以替换annotationProcessor 为kapt

所以在kotlin环境下使用Butterknife的正确姿势

implementation "com.jakewharton:butterknife:10.0.0"
kapt "com.jakewharton:butterknife-compiler:10.0.0"

你可能感兴趣的:(Android,kotlin,Butterknife)