All of sudden I start getting this error, and I am not getting idea why if anyone just let me know where this error is, will be enough helpful. As much I am able to get is t
Shout Out to @Rene Spies' answer above, I also got this error while working with databinding. It turns out the build engine doesn't like it when you put the @Bindable
annotation on a field in the primary constructor of a data class
in Kotlin.
So never do the following,
data class MyAwesomePojo(
@Bindable
var firstname: String,
var lastname: String
)
instead what you need to do is
data class MyCorrectAwesomePojo(
var lastname: String
):{
@get:Bindable
var firstname: String
set(value){
field = value
}
}
Bonus: remember to check for same values before setting value to field if you are trying to use two-way binding like me to prevent infinite looping of setting and getting.