HMS-Core / hms-flutter-plugin

This repo contains all of Flutter HMS plugins.
https://developer.huawei.com/consumer/en/doc/overview/HMS-Core-Plugin?ha_source=hms1
Apache License 2.0
282 stars 139 forks source link

[huawei_iap] Cross-ecosystem app published to Google Play Store #23

Closed deakjahn closed 3 years ago

deakjahn commented 3 years ago

There are some recent changes at Google (https://support.google.com/googleplay/android-developer/answer/9934569). Although the wording says that it will only become effective next year, I have the actual experience right now that the Play Console upload process already refuses to accept any app that has HMS code in it.

We can build two different apps (with different package names) for Play Store and App Gallery, yes. Still, even with the other flavor, some remaining code will be present in the app that makes the Play Store refuse it (and you might be tempted to do the same later, in retaliation, who knows). As far as I can tell, while I can handle with flavors what my own app pulls in as a dependency, I can't do the same with Flutter plugins I reference. So, if I use huawei_iap, for instance, its Gradle setup has:

dependencies {
    implementation 'com.huawei.hms:iap:4.0.4.300'
    implementation 'com.google.code.gson:gson:2.8.5'
}

The actual code might have been removed by tree shaking, probably so, I don't know, but still, there are enough references in the app bundle metadata to make the Play Console refuse the package (actually, without saying a single error message, just a red exclamation point).

(Just to make sure, there's no doubt that the HMS code is triggering this, as soon as I comment them out completely, with everything else unchanged, the app gets accepted during upload.)

Is this something new? Is this something you can have a suggestion about?

aktug commented 3 years ago

Refer: https://stackoverflow.com/questions/64092188/is-huawei-hms-tolerated-on-google-play-store/64095628

deakjahn commented 3 years ago

Please, don't. I wrote that question and there is no usable answer there, this is why I brought it here. This is a current problem that's probably linked to the upcoming changes at Play Store. huawei_app, your own plugin that I refer to, not some third-party plugin somewhere out there. There are remaining meta references in the package that makes Google to refuse the upload. I don't know what you can do about it right now but no, simply suggesting that people use the two-flavor approach will not do because the problem is there with the two-flavor approach. That's the trouble, actually.

deakjahn commented 3 years ago

I can see there is some misunderstanding with Shirley over there. Let me be more clear: I do create a two-flavor app all right. One is appgallery, the other is googleplay.

Yes, this seems to be in direct conflict with what Google says they do, the grace period until next September. Still, it's there. Please, check it out because this makes it very hard to build an app now. Simply selecting the flavor isn't enough, I have to methodically comment out all references to unused HMS code now for it to work.

deakjahn commented 3 years ago

While I can't come up with a repo, obviously (you need a published app on GP and you need access to said app to upload a new bundle), I try to collect the evidence to back up my claim. :-)

First, this is the refusal. No specific error, just that it doesn't work. However, as I will show later, it's obvious to be the HMS code because the error disappears as soon as all--otherwise unused (!)--HMS code had been commented out:

Screenshot 2020-10-15 150346

appgalleryImplementation "com.huawei.agconnect:agcp:1.3.1.300"
appgalleryImplementation 'com.huawei.hms:iap:5.0.2.300'

There is no direct reference to any HMS code in the googleplay flavor. However, as Flutter and Dart doesn't support real conditional compilation, pubspec.yaml needs constantly refer to:

dependencies:
  huawei_iap: ^5.0.0

As far as I can tell, while I have no HMS reference whatsoever in my own code when compiling for googleplay, huawei_iap itself has an obvious dependency of:

dependencies {
    implementation 'com.huawei.hms:iap:4.0.4.300'
    implementation 'com.google.code.gson:gson:2.8.5'
}

I have a hunch that this leaves some metadata references that trigger the denial at Google's.

In other words: it isn't the flavors or anything in my app's gradle settings that causes the problems. It's the Flutter plugin that does it. And while I can fork my own code to two different flavors, I can't do the same with the plugin, I have to depend on it all the time because Flutter won't compile it otherwise.

deakjahn commented 3 years ago

I posted my final solution as an aswer at https://stackoverflow.com/questions/64092188/is-huawei-hms-tolerated-on-google-play-store/64108356. Not really automatic but it works just fine, with minimum effort.