记录AndroidStudio升级2.3后DataBinding与Realm注解冲突问题

· 25字 · 1分钟

现象: 2.3后不支持apt了,所以旧版本Realm编译不通过。

升级Realm后,DataBinding编译失败,报找不到BR错误。

借助kotlin使用kapt “com.android.databinding:compiler:2.3.3"编译后,Realm的相应注解没有被解析,报is not part of the schema for this Realm错误

最终解决: 所有用到注解的三方库,都得加上解释器: annotationProcessor “com.android.databinding:compiler:2.3.3” annotationProcessor ‘org.greenrobot:eventbus-annotation-processor:3.0.1’ annotationProcessor “io.realm:realm-annotations-processor:3.3.2”

参考 1.https://stackoverflow.com/questions/38642712/enable-annotation-processors-option-in-android-studio-2-2 2.https://stackoverflow.com/questions/40940253/realm-and-android-databinding 3.https://developer.android.com/topic/libraries/data-binding/index.html

comments powered by Disqus