android-databindingcode-editorandroid-studio-3.5

Android Studio 3.5 DataBinding BR fields shown as undefined


After upgrading to Android Studio 3.5, I'm always getting data binding errors in code editor:

enter image description here

Any autogenerated field inside BR is marked as red and non existent, but still project compiles fine. How can I fix that? Rebuild project, Invalidate Cache and restart, nothing helped.


Solution

  • I think you are importing wrong BR class. I have changed my import from

    import com.my.packagename.BR;
    

    into

    import androidx.databinding.library.baseAdapters.BR;
    

    It is working fine, now. Enjoy coding...