android data binding: how to get useful error messages -
in android studio 2.1, compile time error messages xml mistakes entirely non-helpful:
error:(11, 41) error: package mypackage.databinding not exist error:(15, 13) error: cannot find symbol class myactivitybinding
the real error "there's no such attribute android:adapter
", or "variable foo doesn't contain property bar" or that. instead of showing such errors, shows above unhelpful ones, tell bindings weren't generated because of unknown error.
there's no easy way now. in general, if face such compilation error , error messages point @ missing databinding classes either bad reference layout (i.e. try access members classes assigned not expose - happens when c&p layouts).
even worse, when use other code generating libraries (icepick, butterknife, etc) real culprit can in code unrelated binding. when occur in code, check gradle console
view , read end up, ignoring error messages related databinding "missing class" or "package not exists"
Comments
Post a Comment