Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Couldn't enable DataBinging for project

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.)

like image 897
Anton N. Avatar asked Aug 11 '26 17:08

Anton N.


1 Answers

Try to replace

dataBinding
{
    enable = true
}

with

dataBinding
{
    enabled = true
}
like image 180
yash786 Avatar answered Aug 14 '26 10:08

yash786



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!