skip to Main Content

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’?

2

Answers


  1. Data binding in build.gradle should be like this:

    android {
        ...
        buildFeatures {
            dataBinding true
        }
    }
    

    Source

    Login or Signup to reply.
  2. 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

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search