如何为风味维度组合配置 Firebase App Distribution?

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

我目前正在开发一个 Android 应用程序,其中有多个风味维度和多个产品风味:

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"
  }

}

我想为每个风味维度组合配置 Firebase App Distribution。

我知道如何为特定产品风格配置 Firebase App Distribution。例如:

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

但我不知道如何为变体配置 firebase:

事实上,我试着写这样的东西:

productFlavors
{

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

但是 gradle 不喜欢我的代码并在我同步时显示以下错误 gradle:

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

提前感谢您的帮助,以帮助我为我的案例正确配置 Firebase App Distribution :)

结论:使用 Firebase App Distribution gradle 插件无法解决此用例。我现在使用 Firebase CLI :

  1. 构建第一个二进制文件(例如使用 gradlew clean bundleProdRelease 的 AAB)

  2. 使用例如 firebase appdistribution:distribute "app/build/outputs/bundle/prodRelease/app-prod-release.aab" --app XXX --token XXX

    执行第一个 firebase 命令
  3. 构建其他二进制文件(例如 gradlew clean packageReleaseUniversalApk)

  4. 执行其他 firebase 命令(例如 firebase appdistribution:distribute "app/build/outputs/universal_apk/preprodRelease/app-preprod-release-universal.apk" --app XXXX --token XXXX 和 firebase appdistribution:distribute "app/build/outputs/universal_apk/qaRelease/app-qa-release-universal.apk" --app XXX --token XXXX)