Android Studio 4.0.1 : Build Failed : option 'android.databinding.enableV2' is deprecated

6.6k Views Asked by At

I recently upgraded to Android Studio 4.0.1 and my build keeps failing with the message:

The option 'android.databinding.enableV2' is deprecated. The current default is 'true'. It has been removed from the current version of the Android Gradle plugin. Databinding v1 is removed.

I tried adding:

android.enableExperimentalFeatureDatabinding = false
android.databinding.enableV2=false

to gradle.properties and gradle-wrapper.properties. but neither solved the issue. Is there something that has to be added or removed from build.gradle possibly?

2

There are 2 best solutions below

0
On

Remove these lines from gradle.properties:

android.enableExperimentalFeatureDatabinding=false
android.databinding.enableV2=false

And rather fix the reason why you've added them properly ("could not make a guess" ...). Also see if not another module might use option android.databinding.enableV2 and try to manually delete the build cache and build directories once. Updating the IDE will only update the Gradle plugin version, it certainly changes nothing else. If you should have such concerns, you probably should use some kind of version control system, which shows all changes in a diff (this also provides unlimited undo and lots of other useful features); Android Studio supports that without plugins.

3
On

The issue was that the line:

android.databinding.enableV2=false

had to be removed from the gradle-properties file in my HOME directory . On a MAC it is located here:

~/.gradle