AtomX
AtomX

Reputation: 374

Can't enable dataBinding even after adding plugin 'org.jetbrains.kotlin.kapt'

The build.gradle script (module) structure is:

plugin {
...
id 'org.jetbrains.kotlin.kapt'
}

android {
...
buildTypes {
...
}
dataBinding {
enabled = true
}
}

If I try to sync my project I get:

Could not set unknown property 'enabled' for BuildType_Decorated{name=dataBinding}

And when I hover in bold enable = true instruction from dataBinding block: If you plan to use data binding in a Kotlin project, you should apply the kotlin-kapt plugin

Why is that happening if I included the plugin above? Both AS and Kotlin plugins are up to date... Is there any difference between 'kotlin-kapt' and 'org.jetbrains.kotlin.kapt'?

Upvotes: 2

Views: 1699

Answers (2)

Aasima Jamal
Aasima Jamal

Reputation: 119

However it is not important to use that plugin to use data bind just do

android { dataBinding { enabled = true} Inside the android brackets

Clean the project and then do sync

Upvotes: 0

AShX
AShX

Reputation: 412

Data binding in build.gradle should be like this:

android {
    ...
    buildFeatures {
        dataBinding true
    }
}

Source

Upvotes: 2

Related Questions