In android studio 2.1, the compile time error messages from xml mistakes are entirely non-helpful:
Error:(11, 41) error: package mypackage.databinding does not exist Error:(15, 13) error: cannot find symbol class MyActivityBinding
The real error would usually be something like "there's no such attribute android:adapter
", or "variable foo doesn't contain property bar" or something like that. But instead of actually showing such errors, it shows the above unhelpful ones, which only tell you that the bindings weren't generated because of some unknown error.
If you want to check for null and empty, it's better to use TextUtils. isEmpty instead.
Kotlin Android Extensions is deprecated, which means that using Kotlin synthetics for view binding is no longer supported.
The way I use in Android Studio 4.0:
Select the top level Build: failed
item on the Build Output
panel
On the right part click Run with --stacktrace
. When build is finished select the top Build: failed
item again on the left panel. You'll get a databinding error description on the right panel:
In my case it's:
[databinding] {"msg":"Cannot find a getter for \u003ccom.google.android.material.slider.Slider app:value\u003e that accepts parameter type \u0027java.lang.Float\u0027\n\nIf a binding adapter provides the getter, check that the adapter is annotated correctly and that the parameter type matches.","file":"SliderDatabinding\src\main\res\layout\activity_main.xml","pos":[{"line0":14,"col0":8,"line1":21,"col1":41}]}
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