Triple-T / gradle-play-publisher

GPP is Android's unofficial release automation Gradle Plugin. It can do anything from building, uploading, and then promoting your App Bundle or APK to publishing app listings and other metadata.
MIT License
4.12k stars 340 forks source link

publishapk failed with updated appid #867

Closed LukeLinXu closed 4 years ago

LukeLinXu commented 4 years ago

Describe the bug

for some reasons, we need to update application id from ends with “.uat” to “.uat2" for 1 special build flavor. So this plugin can upload apk with uat {            dimension “env”            applicationIdSuffix “.uat2"        }

but failed to upload apk with       uat {            dimension “env”            applicationIdSuffix “.uat”        }         android.applicationVariants.all { variant -> if (variant.productFlavors[0].name.equals(“us”) && variant.productFlavors[1].name.equals(“uat”)) {                variant.mergedFlavor.setApplicationIdSuffix(“.uat2”)            }        } so it looks like when plugin try to get applicationId, it will ignore my special setup, and use wrong “commitEditFor” task

android.applicationVariants.all { variant -> is it anyway to make it work?

SUPERCILEX commented 4 years ago

What tasks are you running?

LukeLinXu commented 4 years ago

@SUPERCILEX publishApk, which lead to commitEditFor, where the mistake happened.

SUPERCILEX commented 4 years ago

Right, you probably need to publish the specific product flavor that's valid. publishApk will publish everything. ./gradlew app:tasks --group publishing should give you the list.

LukeLinXu commented 4 years ago

@SUPERCILEX I'm publishing correct specific product flavor.

If I ran "assembleUat", I can get correct apk and applicationId with ".uat2" in both cases.

But when run with publishUatApk, plugin will get application id differently, which lead to different commitEditFor

SUPERCILEX commented 4 years ago

By case 1/2, do you mean publishUatApk is running two actions? If so, you'll need to run the most specific task.

If not, is there a reason you can't just have two separate build types? I'm not really willing to figure out ways to make the plugin work with hacky build logic... though I think if you applied the plugin last, it might get the correct app ids. You'd have to follow the legacy instructions here and then put the apply plugin: "com.github.triplet.play" below everything else.

LukeLinXu commented 4 years ago

@SUPERCILEX thx, yes, cuz we have 1 dimen called "locale" which should lead to multiple uat build, but we just want to make usUat as special case.

to be honest, it works fine before with case2. but after update android.tools.build gradle from 3.5.3 to 4.0.1, then it mess up with this special case. for other flavors , they are working fine.

So I guess might be the gradle changed the why to get applicationId, which lead your plugin failed with this special case.

SUPERCILEX commented 4 years ago

Oh yeah, if an AGP update broke the ordering, I think applying the plugin last could fix it.

LukeLinXu commented 4 years ago

@SUPERCILEX thx, will try

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

LukeLinXu commented 4 years ago

Thx, it works.