使用dataBinding出现Warning:Using incompatible plugins for the annotation processing: android-apt.

在使用dataBinding时,Android Studio出现警告Warning:Using incompatible plugins for the annotation processing: android-apt. This may result in an unexpected behavior.
这里写图片描述
然后编译文件时,报错databinding不存在

上网stackoverflow在查了资料,
发现插件butterknife会与dataBinding冲突,需要更改设置

compile ‘com.jakewharton:butterknife:8.8.1’
apt ‘com.jakewharton:butterknife-compiler:8.8.1’
更改为
compile ‘com.jakewharton:butterknife:8.8.1’
annotationProcessor ‘com.jakewharton:butterknife-compiler:8.8.1’

并且移除apply plugin: ‘android-apt’ 和 classpath ‘com.neenbedankt.gradle.plugins:android-apt:1.8’
使用dataBinding出现Warning:Using incompatible plugins for the annotation processing: android-apt._第1张图片

使用dataBinding出现Warning:Using incompatible plugins for the annotation processing: android-apt._第2张图片

之后再编译就成功了

参考资料https://stackoverflow.com/questions/42632662/android-studio-warning-using-incompatible-plugins-for-the-annotation-processing

你可能感兴趣的:(Android)