BuildKonfig icon indicating copy to clipboard operation
BuildKonfig copied to clipboard

Changing flavor + sync + run has weird behavior

Open Mats-Hjalmar opened this issue 8 months ago • 0 comments

Describe the bug Changing flavor does not reflect in app on first build.

To Reproduce If you have a build konfig that looks like this:

defaultConfigs() {
    buildConfigField(FieldSpec.Type.STRING, "FLAVOR", "local")
}
defaultConfigs("stage") {
    buildConfigField(FieldSpec.Type.STRING, "FLAVOR", "stage")
}
defaultConfigs("prod") {
    buildConfigField(FieldSpec.Type.STRING, "FLAVOR", "prod")
}
// App Code
val flavor = BuildKonfig.FLAVOR // Breakpoint here

If you update flavor in gradle.properties + sync + debug app, the flavor is going to be the previous gradle.properties value is initally but updated on the second run.

Something weird here is that the BuildKonfig.FLAVOR is updated if i go to the source file but the breakpoint's value is the old one.

Expected behavior Changing gradle.properties + sync + build should result in BuildKonfig.FLAVOR to be matching the gradle config for the gradle.properties file.

  • BuildKonfig Version 0.17.0
  • Kotlin Version 2.1.20
  • Gradle Version 8.9

Mats-Hjalmar avatar Apr 25 '25 12:04 Mats-Hjalmar