androidfirebasegradlefirebase-app-distribution

How to configure Firebase App Distribution for a flavor dimension combination?


I am currently working on an Android application in which one there is several flavor dimensions and several product flavors:

flavorDimensions "environment", "deviceType"

productFlavors
{

  playstore
  {
    dimension "deviceType"
  }

  touchpanel
  {
    dimension "deviceType"

    versionNameSuffix "-TouchPanel"
  }

  prod
  {
    dimension "environment"
  }

  integration
  {
    dimension "environment"

    versionNameSuffix "-Integration"
    applicationIdSuffix ".integration"
  }

  dev
  {
    dimension "environment"

    versionNameSuffix "-Dev"
    applicationIdSuffix ".dev"
  }

}

I would like to configure Firebase App Distribution for each flavor dimension combination.

I know how to configure Firebase App Distribution for a specific product flavor. For example:

dev
{
 firebaseAppDistribution
 {
   serviceCredentialsFile = "${projectDir}/src/main/XXXXX.json"
   artifactPath = "${buildDir}/outputs/universal_apk/devRelease/app-dev-release-universal.apk"
   groups = "XXX"
 }
}

But I do not how to configure firebase for the variants:

In fact, I tried to write something like:

productFlavors
{

  devPlaystore
  {
    firebaseAppDistribution
    {
      serviceCredentialsFile = "${projectDir}/src/main/XXXXX.json"
      artifactPath = "${buildDir}/outputs/universal_apk/devRelease/app-dev-release-universal.apk"
      groups = "XXX"
 }
  }
}

But gradle does no like my code and display the following error when I sync gradle:

A problem occurred configuring project ':app'. kotlin.KotlinNullPointerException (no error message)

Thank you in advance for your help in order to help me to configure correctly Firebase App Distribution for my case :)


Solution

  • Conclusion: this use case cannot be resolved using the Firebase App Distribution gradle plugin. I now use the Firebase CLI :

    1. build the first binary (for example an AAB using gradlew clean bundleProdRelease)

    2. execute the first firebase command using for example firebase appdistribution:distribute "app/build/outputs/bundle/prodRelease/app-prod-release.aab" --app XXX --token XXX

    3. build other binaries (for example gradlew clean packageReleaseUniversalApk)

    4. execute other firebase commands (for example firebase appdistribution:distribute "app/build/outputs/universal_apk/preprodRelease/app-preprod-release-universal.apk" --app XXXX --token XXXX and firebase appdistribution:distribute "app/build/outputs/universal_apk/qaRelease/app-qa-release-universal.apk" --app XXX --token XXXX)