Explain build error: The option setting ‘android.defaults.buildfeatures.buildconfig=true’ is deprecated.

That error is coming from Gradle / Android Gradle Plugin (AGP).
Let’s break it down:


The error

The option setting 'android.defaults.buildfeatures.buildconfig=true' is deprecated.

Meaning

  • In your gradle.properties (or sometimes in build.gradle), there’s a setting: android.defaults.buildfeatures.buildconfig=true
  • This was an old way to enable/disable the generation of the BuildConfig.java file.
  • Newer versions of the Android Gradle Plugin (AGP 8.0+) deprecated this android.defaults.buildfeatures.* syntax.

How to fix

Instead of putting it in gradle.properties, you should configure it directly in your module’s build.gradle (app/build.gradle):

android {
    buildFeatures {
        buildConfig = true
    }
}
  • If you don’t actually need the BuildConfig class, you can just remove the deprecated line from gradle.properties and leave it disabled.
  • If you do need it, add the above block in build.gradle.

Why this change?

Google is moving away from global settings in gradle.properties (android.defaults.buildfeatures...) because they want all build feature configurations to be module-specific.
This makes multi-module projects easier to configure and avoids confusion.




Leave a Reply