Android DataBinding class L***/****/common/BR 中没有类型 I 的现场设备
Android DataBinding No field device of type I in class L***/****/common/BR
我有一个项目,我试图在将包含的不同应用程序之间共享通用代码。
现在我只有一个公共模块作为 android 库,我在其中移动了一个片段及其所有链接资源,因此我可以在我的主应用程序模块上使用它。
我能够正确显示布局,但是当我尝试将变量绑定到此布局时出现以下错误:
java.lang.NoSuchFieldError: No field device of type I in class L***/****/common/BR; or its superclasses (declaration of '**.****.common.BR' appears in /data/app/***.****.******-9VGDieZHqLKJUD0xhdmawA==/split_lib_slice_6_apk.apk)
查看堆栈跟踪,问题发生在我的片段生成的数据绑定 class 中,此方法:
public void setDevice(@Nullable **.***.common.vo.Device Device) {
this.mDevice = Device;
synchronized(this) {
mDirtyFlags |= 0x1L;
}
notifyPropertyChanged(BR.device);
super.requestRebind();
}
特别是在这个调用中:notifyPropertyChanged(BR.device)
.
显然生成的 class 在合并的 BR 文件中找不到 BR.device
,但它仍然是在拆分的 APK 中找到的...
我不知道这是配置问题还是合并过程中的错误...
我们将不胜感激。
检查两个模块的包名是否相同。
我有类似的错误,这是由于我的 lib 模块有
与我的应用程序模块相同的包名。
示例:
com.app.example(应用模块包名)
com.app.example(lib模块包名)
我改成了这样:
com.app.example(应用模块包名)
com.lib.example(lib模块包名)
我有一个项目,我试图在将包含的不同应用程序之间共享通用代码。
现在我只有一个公共模块作为 android 库,我在其中移动了一个片段及其所有链接资源,因此我可以在我的主应用程序模块上使用它。
我能够正确显示布局,但是当我尝试将变量绑定到此布局时出现以下错误:
java.lang.NoSuchFieldError: No field device of type I in class L***/****/common/BR; or its superclasses (declaration of '**.****.common.BR' appears in /data/app/***.****.******-9VGDieZHqLKJUD0xhdmawA==/split_lib_slice_6_apk.apk)
查看堆栈跟踪,问题发生在我的片段生成的数据绑定 class 中,此方法:
public void setDevice(@Nullable **.***.common.vo.Device Device) {
this.mDevice = Device;
synchronized(this) {
mDirtyFlags |= 0x1L;
}
notifyPropertyChanged(BR.device);
super.requestRebind();
}
特别是在这个调用中:notifyPropertyChanged(BR.device)
.
显然生成的 class 在合并的 BR 文件中找不到 BR.device
,但它仍然是在拆分的 APK 中找到的...
我不知道这是配置问题还是合并过程中的错误...
我们将不胜感激。
检查两个模块的包名是否相同。 我有类似的错误,这是由于我的 lib 模块有 与我的应用程序模块相同的包名。
示例:
com.app.example(应用模块包名) com.app.example(lib模块包名)
我改成了这样:
com.app.example(应用模块包名) com.lib.example(lib模块包名)