使用 Flutter 为 Google Play 和华为应用程序库部署应用程序的最佳方式是什么?

What is the best way to deploy the app for both Google Play and Huawei's App Gallery using Flutter?

我们已经在 Google Play 中使用 Flutter 与 GMS 集成发布了多个应用程序。现在,我们想将现有的应用程序发布到华为应用程序库。目前,该应用程序已与 GMS 和 HMS 集成以进行推送通知,并且运行良好。为了区分该应用,我们使用与 Google Play 商店不同的签名为 App Gallery 的 apk 签名。

经过一番研究,我们发现app bundle id需要以.huawei后缀结尾才能与IAP集成。我们不使用任何 IAP,但将来可能会使用。但是,由于 GMS 的 bundle id 没有使用 .huawei 后缀,我们在构建应用程序时遇到了一些问题。我们更喜欢将相同的代码库用于 Google Play 和 App Gallery。

我的问题是在华为应用程序库中发布的app bundle id是否有必要包含.huawei后缀。如果是,使用 Flutter 为 Google Play 和 App Gallery 部署应用程序的最佳方式是什么。

My question is that is it necessary to include the .huawei suffix for app bundle id released in Huawei App Gallery.

请先确认您要发布的应用类别:

  1. 对于普通应用,.huawei不是必须的
  2. 对于游戏应用,.huawei是必须的。

在游戏类APP被强行改包名的场景下,建议使用多渠道打包。华为渠道包名添加.huawei后缀。在app目录下build.gradle文件productFlavor中更改包名

flavorDimensions "flavor"
productFlavors{
    huawei {
        applicationId "com.huawei"
        dimension "flavor"
    }
    appMarket2{
        applicationId "com.appMarket2"
        dimension "flavor"
    }
}

多渠道打包详见docs