0%

DataBinderMapperImpl无法生成

MVC的一个老项目,需要从另一个MVVM的项目里移植过来一些功能,新建了一个module开启了databinding后报错

1
ClassNotFoundException: Didn't find class "android.databinding.DataBinderMapperImpl" on path

谷歌之,在Stack Overflow上看到一段提示:

Got my own lib and multiple apps. Had to add both to lib and app gradle files.

解决方法

lib module与 app module都需要在各自的 gradle 文件中开启databinding:

1
2
3
4
5
6
android {
....
dataBinding {
enabled = true
}
}

参考:Stack Overflow