18.8 Migrating a Project to View Binding
The process for converting a project module to use view binding involves the following steps:
1. Edit the module level Gradle build script file listed in the Project tool window as Gradle Scripts -> build.gradle (Module: <project name>.app) where <project name> is the name of the project (for example AndroidSample).
2. Locate the android section of the file and add an entry to enable the viewBinding property as follows:
android {
buildFeatures {
viewBinding true
}
.
.
3. Click on the Sync Now link at the top of the editor to resynchronize the project with these new build settings.
4. Edit the MainActivity.kt file and modify it to read as follows (where <reverse domain> represents the domain name used when the project was created and <project name> is replaced by the lowercase name...