← Back to list

defaultConfig contains custom resource values, but the feature is disabled

After upgrading Android Gradle Plugin (AGP) 8+, many developers see the warning: “defaultConfig contains custom resource values, but the…

BytesBee · 2026-01-21 06:53 · 0 claps · 1.3 min read
#android-gradle #gradle #build-error #agp #androiddev
Open on Medium ↗

Fixed Error: defaultConfig

defaultConfig contains custom resource values, but the feature is disabled

After upgrading Android Gradle Plugin (AGP) 8+, many developers see the warning: “defaultConfig contains custom resource values, but the feature is disabled.”

This article explains why it happens, what it means, and how to fix it properly using buildFeatures.

The Problem

After upgrading your Android project to Android Gradle Plugin (AGP) 8+, you may see this warning:

defaultConfig contains custom resource values, but the feature is disabled.

This usually appears even though your app still builds successfully—but your custom values may not work correctly.

Why This Happens

In newer AGP versions, some features are disabled by default to improve build performance.

If yours build.gradle contains:

defaultConfig {
    resValue "string", "api_url", "https://example.com"
}

or

defaultConfig {
    buildConfigField "String", "BASE_URL", "\"https://example.com\""
}

Then Android requires you to explicitly enable these features.

The Fix—Enable Required Build Features

Add this inside your android {} block in app-level build.gradle.

Groovy (build.gradle)

android {
    buildFeatures {
        resValues true
        buildConfig true
    }
}

Kotlin DSL (build.gradle.kts)

android {
    buildFeatures {
        resValues = true
        buildConfig = true
    }
}

Alternative: Remove resValue Usage

If you don’t really need resValue, move values to:

res/values/strings.xml

<string name="api_url">https://example.com</string>

And access normally:

getString(R.string.api_url)

This avoids the need for enabling resValues.

Why Google Changed This

AGP now uses feature flags to:

  • Reduce unnecessary code generation
  • Speed up builds
  • Improve modular compilation

So features like

  • BuildConfig generation
  • Resource value injection

must be explicitly enabled

Love the material? Buy me a coffee! ☕

Thanks for reading. ❤️❤️❤️❤️

See you in next blogpost 👋👋👋

We appreciate your involvement in the community.

Before you go:


메타데이터
post_id
98d9b09f5aaf
slug
defaultconfig-contains-custom-resource-values-but-the-feature-is-disabled-98d9b09f5aaf
url
https://medium.com/@bytesbee/defaultconfig-contains-custom-resource-values-but-the-feature-is-disabled-98d9b09f5aaf
canonical_url
https://medium.com/@bytesbee/defaultconfig-contains-custom-resource-values-but-the-feature-is-disabled-98d9b09f5aaf
author_url
https://medium.com/@bytesbee
status
ok
fetched_at
2026-06-23 03:48:11