Skip to content

Changing flavor + sync + run has weird behavior #210

@Mats-Hjalmar

Description

@Mats-Hjalmar

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions