[英]Viewbinding with error: incompatible with attribute android:visibility
[英]ViewBinding error in Android project with Data Binding
我有一个使用数据绑定的项目:
buildFeatures {
dataBinding true
}
在我将其更改为:
buildFeatures {
dataBinding true
viewBinding true
}
gradle 同步很好,但是在尝试运行项目时出现数据绑定类错误:
:app:kaptHomologDebugKotlin
app/build/generated/source/kapt/homologDebug/br/com/test/DataBinderMapperImpl.java
cannot find symbol class ConfirmacaoFragmentBindingImpl
java.lang.reflect.InvocationTargetException (no error message)
Cannot find a setter for that accepts parameter type 'int'
我已经尝试过重建并使缓存无效
文档说“由于这些考虑,在某些情况下最好在项目中同时使用视图绑定和数据绑定” 。
所以可以在一个项目中同时拥有两者
当我尝试在已经启用数据绑定的现有项目上使用视图绑定时,我遇到了同样的问题,在我的情况下,问题是由一些包含(这些包含在使用数据绑定的布局内部使用)和一些引起的那些用作包含的布局中没有布局标签,需要布局标签来生成数据绑定实现类,我不知道这个冲突的确切原因,但是当我启用视图绑定时,错误开始发生,因此通过将布局标记放置在与数据绑定一起使用的所有布局中或作为包含在具有数据绑定的布局中,我可以解决我的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.