databinding does not exist: How to solve it?

This problem occurs usually if your project does not compile. Android databinding should generate code in the named package, but it can't do that if the project doesn't compile in the first place.

To solve this, bring your project to a point where it compiles. If necessary, turn databinding off for this.


check out your xml files and comment any @{} you have used unless you actually have your data ready at hand. With no data, you'll bump into this error again and again and again.


I came across this issue in a project of 4 modules in Android Studio 2.3, it is what @F43nd1r indicated, but want to document what I did to resolve this in my case.

One of the 4 modules had an older Android Support library in in the Gradle file for it, while the other 3 were current. This is what prevented the project from compiling properly and causing the databinding error.

The difficult part was that you don't know about this unless you open each build.gradle file and see if there is an error displayed. It did NOT show an error for it on compile.

Effectively I updated this area to the newer version number to match the other 3 module build.gradle files.

dependencies {
    ...
    compile 'com.android.support:appcompat-v7:25.2.0'
    compile 'com.android.support:support-v4:25.2.0'
    compile 'com.android.support:recyclerview-v7:25.2.0'
    compile 'com.android.support:design:25.2.0'
    ...
}