2

When I'm trying to enable Databinding in newly created test project (dataBinding {enable=true}), I get the message

Could not set unknown property 'enable' for object of type com.android.build.gradle.internal.dsl.DataBindingOptions.

Also there is no autocompletion for the data binding. (But it is here for app.dataBinding - but I can't understand how to use it)

My app.gradle:

android {
    compileSdkVersion 28
    dataBinding {
        enable = true
    }
    defaultConfig {
        applicationId "com.testapp"
        minSdkVersion 19
        targetSdkVersion 28
    }
    ...
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.android.support:design:28.0.0'
}

And project gradle:

buildscript {
    ext{
        kotlin_version = '1.3.21'
        gradleVersion = '3.1.0'
    }
    ...
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

Android Studio 3.3.1, Support library is installed (with Android support repository etc.)

Zoe
  • 27,060
  • 21
  • 118
  • 148
Anton N.
  • 137
  • 2
  • 12

1 Answers1

10

Try to replace

dataBinding
{
    enable = true
}

with

dataBinding
{
    enabled = true
}
Wai Ha Lee
  • 8,598
  • 83
  • 57
  • 92
yash786
  • 1,151
  • 8
  • 18