36.2 Enabling Data Binding
The first step in using data binding is to enable it within the Android Studio project. This involves adding a new property to the Gradle Scripts -> build.gradle (Module: ViewModelDemo.app) file.
Within the build.gradle file, add the element shown below to enable data binding within the project:
plugins {
id 'com.android.application'
}
android {
buildFeatures {
viewBinding true
dataBinding true
}
.
.
}
Once the entry has been added, a yellow bar will appear across the top of the editor screen containing a Sync Now link. Click this to resynchronize the project with the new build configuration settings.