I have some code that is generating a "red squiggly" error in Android Studio:
@get:Bindable
var title: String = ""
set(value) {
field = value
notifyPropertyChanged(BR.title)
}
It complains that "title" is an unresolved reference on BR.title
. Building and running works fine though, and this is the only error I can see. I debug there and see that it's gotten the value for BR.title
correctly.
Still, I can't figure out how to make it go away. I verified that the generated BR class has the "title" field, but Android Studio refuses to recognize this. I've looked up people having this issue and have tried the following: (unsuccessfully)
I have also checked and I have apply plugin: 'kotlin-kapt'
in build.gradle.
Anyone know what's going on? I assume it must be holding onto some cache files somewhere but I don't know where.
What fixed the problem for me was adding the following import to my files:
import androidx.databinding.library.baseAdapters.BR
I'm not entirely certain why this works, but it got rid of all the analysis problems and the application still compiles and works fine, so I'm personally happy.
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