I'm maintaining an older Java project that uses data binding.
After updating Android Studio to Ladybug version, I upgraded Gradle from 7.5 to 8.5. However, after I've done that, I am no longer able to build the project. Build output is showing this error:
Build file '/home/users/.../AndroidStudioProjects/.../.../app/build.gradle' line: 62
A problem occurred evaluating project ':app'.
> Value is null
where line 62 points to dataBinding
in buildFeatures
. Here is a snippet from build.gradle
file:
buildFeatures {
dataBinding {
enabled = true
}
}
After some digging, I wasn't able to find a similar issue nor the solution. Only after checking the official data binding documentation, I saw that data binding was not configured in the same way so I tried replacing:
dataBinding {
enabled = true
}
with
dataBinding true
That indeed resulted in the project being able to build again.
The syntax dataBinding { enabled = true }
is outdated and it is not supported in newer versions of the Android Gradle Plugin. Starting from AGP 4.1, dataBinding true
is the correct way to use data binding.