8/3/2020 update
After update to AS 3.6.1 you should update your android gradle version to 3.6.1
> classpath 'com.android.tools.build:gradle:3.6.0'
Orignal solution
Android Studio 3.6 and above, From the Left menu, select Project
> Gradle Scripts
> gradle-wrapper.properties
then modify the distributionUrl
and set it to https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
after that sync your project with Sync Project with Gradle Files
, after it's finished go back to your build.gradle (Project)
and update the dependencie of gradle classpath to classpath 'com.android.tools.build:gradle:3.6.0'
, almost done.
Now it's time to enable it, in your build.gradle(:app)
set it
viewBinding {
enabled = true
}
12/16/2020 update
With classpath 'com.android.tools.build:gradle:4.1.1'
viewBinding
is deprecated, you have to use:
buildFeatures {
viewBinding = true
}