Android databinding: cannot find ...BindingImpl in generated databinding file
In your xml code inside textView tag, for android:text attribute you have used @{viewmodel}. It just refers your shopViewModel class, you must target the text variable inside that class. Then the gen. class file errors will vanish.
bindingImpl errors are mostly generated for invalid assignment for XML-text or XML-onClick attributes.
If you use two-ways databinding (@={myBindingValue}
, with the '=' sign instead of @{myBindingValue}
) sometimes, you'll have this unusefull generic error because the value you are trying to bind is declared as immutable => val instead of var in Kotlin in your data class.
Exemple :
data class User(
val name,
var email
)
In this example, you could bind the user's email variable as : text="@={myViewModel.user.email}"
But, if you try to bind the user's name : text="@={myViewModel.user.name}"
you will get this error.
It seems the only thing I had to add was <import type="android.view.View" />
in the data tags...