Data binding class not generated in latest studio 3.6

This happened to me as well. The binding classes are actually generated. The project builds fine. Only Android Studio 3.6.1 (or underlying Gradle build system, I do not care) is buggy and cannot see these classes.

As an intermediate solution, I just hacked the source sets (please note that build variants in the fragment below are specific to my project, you need to rewrite it).

android {
    ...
    sourceSets {
        demoDebug {
            java.srcDirs += 'build/generated/data_binding_base_class_source_out/demoDebug/out'
        }
        fullDebug {
            java.srcDirs += 'build/generated/data_binding_base_class_source_out/fullDebug/out'
        }
        espressoDebug {
            java.srcDirs += 'build/generated/data_binding_base_class_source_out/espressoDebug/out'
        }
        demoRelease {
            java.srcDirs += 'build/generated/data_binding_base_class_source_out/demoRelease/out'
        }
        fullRelease {
            java.srcDirs += 'build/generated/data_binding_base_class_source_out/fullRelease/out'
        }
        espressoRelease {
            java.srcDirs += 'build/generated/data_binding_base_class_source_out/espressoRelease/out'
        }
    }
    ...
}

As pointed by Steve above: In the mean time, we have to patiently wait for Google to fix it...

EDIT

I have just realised it is MUCH more buggy than I expected, the layouts are broken too:

Please please dear Google: Do not release unstable intermediate versions to us"

I hope Google will fix this mess soon...

EDIT 2

I have realized again that Android Studio 3.6 is even more buggy than described above.

The execution of existing Espresso tests is broken too.

I strongly discourage everyone from upgrading to Android Studio 3.6.

I the mean time, we will probably downgrade back to Android Studio 3.5.


I am using android studio 3.6.1 the problem solved after adding viewBinding.enabled = true to android{ in build.gradle :

android {

...
    dataBinding {
        enabled = true
    }
    viewBinding.enabled = true

Update: Make sure you add apply plugin: 'kotlin-android-extensions' in top of App Module gradle file :

  plugins {
    id 'com.android.application'
    id 'kotlin-android'
    id 'kotlin-kapt'
    id 'kotlin-android-extensions' //<--
  }

Just update your Gradle version to the latest. Go to:

File > Project Structure > Gradle Version

And select the latest stable version (currently 6.3). Check also your Android Gradle Plugin Version if it's also pointing to the latest.