Handling DataBinding errors when switching Git branch

眉间皱痕 提交于 2020-08-06 20:42:10

问题


I have a lot of issues with DataBinding when switching between Git branches where a databinding layout has been changed/removed. I regularly get build errors like this when a file is removed when switching Git branch:

<path>/build/generated/data_binding_base_class_source_out/debug/dataBindingGenBaseClassesDebug/out/com/some/package/databinding/SomeLayoutBinding.java:38: error: cannot find symbol
    public final SomeOtherLayoutBinding variable;

...and try every combination of

  • Clean Project
  • ./gradlew cleanBuildCache
  • Sync project with gradle
  • Invalidate/Restart

but ultimately none of it resolves the issue.

The only thing I've found that works is to clear the gradle cache in my home directory like:

rm -rf ~/.gradle/caches

however this results in my next build taking up to 10min.

Is it really supposed to be like this? Why can't it detect that a file is added/removed when switching branch?

来源:https://stackoverflow.com/questions/58340113/handling-databinding-errors-when-switching-git-branch

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!