skip to Main Content

I am migrating to Kotlin dsl and I can’t set buildFeatures property databinding any more. It is missing from AppExtension class. It is happening in dynamic feature module

Any suggestions?

Before in Groovy worked

android {
   buildFeatures {
     dataBinding = true 
   }
}

Kotlin is not working either the same syntax or

buildFeatures.dataBinding = true 

Attaching some screenshots.

The error is

Unresolved reference: dataBinding

enter image description here
enter image description here
enter image description here

2

Answers


  1. Chosen as BEST ANSWER

    After submitting a ticket to Google the answer is to use https://issuetracker.google.com/issues/193452960

    android.dataBinding.isEnabled = true
    

    Based on the dev reply marking it as deprecated is a bug and should not be thee case in kts.

    From the ticket:

    Sorry for the mixed messages about build features, we realized that it made more sense to put the enable flag for features next to the feature itself. The plan is that the supported path will be:android.dataBinding.isEnabled = true Which works today in kts, but is currently incorrectly marked as deprecated.


  2. You could try to upgrade your AGP.

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