7

I have an issue with Firebase Distribution configuration. Here's a part of my build.gradle in Kotlin DSL

flavorDimensions("dim")
productFlavors {
    
    create("fl1") {
        applicationIdSuffix = ".fl1"
        setDimension("dim")
        firebaseAppDistribution {
            releaseNotes = "$name"
            groups = "group-fl1"
        }
    }

    create("fl2") {
        applicationIdSuffix = ".fl2"
        setDimension("dim")
        firebaseAppDistribution {
            releaseNotes = "$name"
            groups = "group-fl2"
        }
    }

}

Flavor 1 and flavor 2 are uploaded to 2 different Firebase projects - therefore I have two google-services.json files in: src/fl1 and src/fl2.

From observation Firebase App Distribution plugin uses always the config from second firebaseDistribution block. It looks like this is not set to flavor but globally. When I invoke for example assembleFl1Debug appDistributionUploadFl1Debug the correct .apk lands in correct Firebase project, but both release notes and groups are not correct. Anyone had a similar issue?

user2290148
  • 141
  • 8

2 Answers2

6

I reported this to Firebase support and just received a confirmation that it is bug, but no workaround or fix date is scheduled yet :( This concerns only build.gradle files written in Kotlin DSL.

user2290148
  • 141
  • 8
  • 1
    do you have a link to that bug report? – Francis Aug 19 '20 at 08:35
  • No, Firebase Support handled this by email. I can forward you their message. Right now we are forced to use the CLI to make this work with Kotlin DSL – user2290148 Aug 20 '20 at 21:21
  • Do you have a link to a support ticket they may have created? I'm running into a similar issue now: I want to change the artifactPath on per-variant basis, but the extension is registered per-Project instead of per-Task. – Miles Peele Oct 25 '22 at 17:48
3

It's a bug, but until it's fixed, instead of firebaseAppDistribution { ... }, you may use:

configure<AppDistributionExtension> {
  ...
}

That way you can make a dynamic configuration that doesn't get overriden.

Diolor
  • 13,181
  • 30
  • 111
  • 179