DataBinding Guide States
By default, a Binding class will be generated based on the name of the layout
file, converting it to Pascal case and suffixing “Bindi
I ran into a similar issue that hasn't been mentioned here yet. In my case, I incorrectly added
as the tag versus
.
is apparently a valid tag because Android Studio didn't complain (other than requiring layout_width and layout_height which aren't required for
). The capitalization difference will manifest in similar behavior where you cannot import the databinding class (import com.example.android.aboutme.databinding.ActivityMainBinding in my case) in the MainActivity class even though
is a valid tag and the build.gradle file is defined properly to support data binding.
In my case, I did not need the tags defined yet in order for ActivityMainBinding to validly import and be referenced in:
private lateinit var binding: ActivityMainBinding
I was working through the this codelab when I ran into this behavior: https://developer.android.com/codelabs/kotlin-android-training-data-binding-basics/index.html