Possible reason for “Error:cannot generate view bi

2020-06-30 05:37发布

问题:

I am using Android Studio for my Android projects. I faced an issue when builds crash with strange stacktrace, like this:

Error:Execution failed for task ':app:compileDevDebugJavaWithJavac'.
 java.lang.RuntimeException: failure, see logs for details.
  cannot generate view binders java.lang.NullPointerException
    at android.databinding.tool.reflection.ModelMethod.isBoxingConversion(ModelMethod.java:155)
    at android.databinding.tool.store.SetterStore.isBetterParameter(SetterStore.java:946)
    at android.databinding.tool.store.SetterStore.getBestSetter(SetterStore.java:838)

and it was seemed that the databinding became broken as whole.

I made refactoring before and moved classes between packages.