I am getting started for using DataBinding
feature. I am facing problem with it.
Error:(21, 9) error: cannot find symbol class ContactL
Sometimes the reason of these errors are not the DataBinding
itself, but some other part of our code. In my case I had an error in Room
database so the compiler couldn't generate the binding classes and it gives me these errors.
According to Google:
Previous versions of the data binding compiler generated the binding classes in the same step that compiles your managed code. If your managed code fails to compile, you might get multiple errors reporting that the binding classes aren't found. The new data binding compiler prevents these errors by generating the binding classes before the managed compiler builds your app.
So to enable new data binding compiler, add the following option to your gradle.properties file:
android.databinding.enableV2=true
You can also enable the new compiler in your gradle command by adding the following parameter:
-Pandroid.databinding.enableV2=true
Note that the new compiler in Android Studio version 3.2 is enabled by default.