Google Play商店可以容忍华为HMS吗? [英] Is Huawei HMS tolerated on Google Play Store?

查看:181
本文介绍了Google Play商店可以容忍华为HMS吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有常规Google广告和应用内付款内容的应用.它已被Play商店接受.现在,我想使其同时支持GMS和HMS(基于适当服务的可用性,该应用可以决定使用哪个平台).内置了华为功能的应用程序在我自己的设备上进行测试时可以正常工作.

I have an app with the usual Google ad and in-app-payment stuff. It's accepted into the Play Store all right. Now I'd like to make it support both GMS and HMS at the same time (based on the availability of the appropriate services, the app can decide which platform to use). The app, with the Huawei functionality built in, works just fine while testing on my own devices.

但是,只要将华为的库与该应用程序捆绑在一起,Play Store Console就会拒绝它.没有错误消息,只是一个红色的感叹号.毫无疑问,我开始一个接一个地删除与华为相关的部件,并且在删除了最后一部分后,该捆绑包又自动被接受了.

However, as soon as Huawei's libraries are bundled with the app, the Play Store Console simply refuses it. No error message, just a red exclamation point. There's no doubt about the situation, I started to remove the Huawei-related parts one by one and as soon as the last bit was removed, the bundle was automagically accepted again.

是的,可以肯定,我可能犯了一些我不知道的错误,但情况确实令人怀疑.如果有什么不同,我会使用Flutter,然后尝试按照通常的方式上载应用捆绑包,而不是APK.似乎成功或失败的HMS库是来自 https://developer.huawei.com/repo/的maven存储库中的 com.huawei.hms:hwid:4.0.0.300 .

Yes, sure, I might have made some error I'm not aware of but the situation is, well, rather suspicious. If it makes any difference, I use Flutter and I try to upload an app bundle, not APKs, as per normal these days. The HMS library that seems to make it or break it is com.huawei.hms:hwid:4.0.0.300 from the maven repo at https://developer.huawei.com/repo/.

那么,我只是看东西吗?

So, am I just seeing things or not?

好,任务继续进行.

这是最近的新闻: https://support.google.com/googleplay/android-developer/answer/9934569

任何当前正在使用替代结算系统的现有应用将需要删除它以符合此更新.对于这些应用,我们提供延长的宽限期至2021年9月30日,以使任何必要的更改.2021年1月20日之后提交的新应用将需要遵守.

Any existing app that is currently using an alternative billing system will need to remove it to comply with this update. For those apps, we are offering an extended grace period until September 30, 2021 to make any required changes. New apps submitted after January 20, 2021 will need to be in compliance.

无论政策如何规定,Play控制台似乎已经强制执行了.正如我通过查看应用程序捆绑包发现的那样,仅靠风味方法是不够的.即使具有其他风味,Flutter仍会保留一些包装.也许只是引用的名称,而不是摇树后的实际代码,但这已经足够了.

No matter what the policy says, the Play Console seems to enforce it already. And as I found by looking into the app bundle, the flavor approach is just not enough. Even with the other flavor, there will remain some packages referenced by Flutter. Maybe just the referenced names, not the actual code after tree shaking, but this is already enough for the refusal.

因此,归根结底,我真的认为这个问题需要解决,并且如果我们真的想编写跨生态系统,单源Flutter应用程序,那么开发人员应该为自己找到一些明确的准则.至于我,我当然想这么做.

So, at the end of the day, I really think this question needs to be sorted out and some clear guidelines found for and by ourselves, developers, if we really want to write cross-ecosystem, single source Flutter apps. As for me, I sure want to do it.

推荐答案

我终于找到了一种解决方法,它不是自动的,而是一种可用的方法.

I have finally found a kind of a workaround, not automatic, but a useable approach.

在您的项目中创建两个子包.它们看起来像普通的Flutter软件包,但驻留在您的应用程序内部.基本上,在通常的 lib 旁边创建两个文件夹,分别为 gms_support hms_support .两者都是具有通常结构的软件包:

Create two subpackages inside your project. They look like normal Flutter packages but reside inside your app. Basically, create two folders, gms_support and hms_support beside your usual lib. Both are packages with the usual structure:

  • lib
  • lib \ Xms_support.dart
  • lib \ src
  • lib \ pubspec.yaml

将所有与供应商相关的内容放入相应的 lib \ src 文件夹内的结构相同的文件中,并确保两个 XXX_support.dart 文件均以常规方式导出它们.实现应使用相同的类和相同的签名.每个 pubspec.yaml 都引用其实现所需的特定于供应商的Flutter插件.

Put all your vendor-dependent stuff into identically structured files inside the respective lib\src folders and make sure both XXX_support.dart files export them the usual way. The implementations should use the same classes and same signatures. Each pubspec.yaml refers to its own, vendor-specific Flutter plugins required for their implementation.

您的主应用程序 pubspec.yaml 包含两个引用:

Your main app pubspec.yaml contains both references:

dependencies:
  ...
  gms_support:
    path: gms_support/
  hms_support:
    path: hms_support/

此外,在您的主应用程序内添加另一个 support.dart :

Also, add another support.dart inside your main app:

export 'package:gms_support/gms_support.dart';
export 'package:hms_support/hms_support.dart';

只要您需要在应用程序中进行特定于供应商的行为,就可以导入并使用此 support.dart 文件.

Wherever you need vendor-specific behavior in your app, you import and use this support.dart file.

然后,当您必须从一种口味更改为另一种口味时,总是必须同步更改项:

Then, when you have to change from one flavor to another, you always have to change three things in sync:

  • 风味(请参阅您的IDE的详细信息)
  • support.dart
  • 中注释其他导出
  • pubspec.yaml 中注释掉另一个引用,并进行发布更新
  • the flavor (see the details of your IDE)
  • comment out the other export in support.dart
  • comment out the other reference in pubspec.yaml and make a pub update

这篇关于Google Play商店可以容忍华为HMS吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆