I have a ViewModel with:
val imageUrl = ObservableField<String>()
My layout XML has:
<ImageView
...
app:url="@{viewModel.imageUrl}"
.../>
I have a BindingAdapters file with a top level function:
@BindingAdapter("url")
fun loadImage(view: ImageView, url: String?) {
...
}
I'm getting the following error:
data binding error msg:Cannot find the setter for attribute 'app:url' with parameter type android.databinding.ObservableField<java.lang.String> on android.widget.ImageView.
Any idea why this would be? This is pretty much identical to how I set up binding adapters in Java, minus the static function.
This issue was caused by a lack of kapt in the app's build.gradle. Adding the below to build.gradle and replacing all "annotationProcessor" dependencies with "kapt" fixes the issue.
apply plugin: 'kotlin-kapt'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With