Android Studio fails to generate databinding after 3.1.0 update

Following the update to Android Studio 3.2, this line works for me. I have both Java and Kotlin code (compiler) running in my project.

Add the following to your gradle.properties:
android.databinding.enableV2=false

Reason:

Data Binding V2

Data Binding V2 is now enabled by default and is compatible with V1. This means that, if you have library dependencies that you compiled with V1, you can use them with projects using Data Binding V2. However, note that projects using V1 cannot consume dependencies that were compiled with V2.

source (Release Note): https://developer.android.com/studio/releases/

Just Commenting these lines out in graddle-wrapper.properties file helped me solve my problem

#android.enableExperimentalFeatureDatabinding = true
#android.databinding.enableV2=true

if you’re using kotlin on android studio 3.2 ,
replace the distributionurl with this line

distributionUrl=https://services.gradle.org/distributions/gradle-4.6-all.zip

and you’ll be asked to change the build tools version to the apprpriate version.
once you’ve done that , remove this line from the app level build.gradle file

kapt 'com.android.databinding:compiler:3.0.1

and build the project. it worked for me.

Leave a Comment