Gradle-play-publisher: Can't upload mapping file when artifactDir is specified

Created on 1 Sep 2019  路  11Comments  路  Source: Triple-T/gradle-play-publisher

Describe the bug

A proguard mapping is not uploaded when using a custom artifact dir.

play {
  serviceAccountCredentials = file("api.json")
  track = "internal"
  releaseStatus = "completed"
  resolutionStrategy = "auto"
  artifactDir = file("$projectDir/build/outputs/apk/release")
}

In proguard-rules.pro I have a line, so that mapping.txt is existent in two places:

  1. app/build/outputs/apk/release/mapping.txt
  2. app/build/outputs/mapping/release/mapping.txt
-printmapping build/outputs/apk/release/mapping.txt

How To Reproduce

Versions

  • Gradle Play Publisher: 2.3.0
  • Gradle Wrapper: 5.4.1
  • Android Gradle Plugin: 3.5.0

Tasks executed

publishApk, publishReleaseApk

Expected behavior

The mapping is uploaded to GPlay.

bug waiting-for-reply

Most helpful comment

While publishing a release, I execute two separate commands:

  1. ./gradlew -Pci --console=plain clean lint assembleRelease --stacktrace
  2. ./gradlew publishApk --stacktrace

After the first command, I manually go to the release folder and find that both app-release.apk and mapping.txt files are in place, precisely in $projectDir/app/build/outputs/apk/release.

Then, I execute the second command, and it does upload only APK file. This is clearly not how it is documented in README.md and is a bug. Why would you close it?

All 11 comments

This is normal: the mapping file needs to be in the same folder as the artifact dir. If you're just using the APK that's built straight from AGP, then let GPP handle everything for you.

But as I originally stated, the mapping and the APK file are generated in the same folder (build/outputs/apk/release/).

While publishing a release, I execute two separate commands:

  1. ./gradlew -Pci --console=plain clean lint assembleRelease --stacktrace
  2. ./gradlew publishApk --stacktrace

After the first command, I manually go to the release folder and find that both app-release.apk and mapping.txt files are in place, precisely in $projectDir/app/build/outputs/apk/release.

Then, I execute the second command, and it does upload only APK file. This is clearly not how it is documented in README.md and is a bug. Why would you close it?

Hmmm

  • Why are you using artifactDir at all? Just run publishApk and GPP will handle everything for you.
  • About the mapping file, are you sure it's not empty? And when you say it's not uploaded, can share a sample of where you're getting that information. Lastly, can you try a snapshot build?
  1. I am using it in order not to rebuild the APK. publishApk without an artifact dir definitely works, however I would like to not rebuild an APK.

  2. Yes, I've just checked the mapping file, and it's not empty.

  3. Sure, the info I get is from Google Play Store. The three greened check marks were done without a custom artifact dir.

image

  1. I have just checked my git history and it seems that I have already tried the snapshot build. Unfortunately, it hasn't helped.
  1. I don't understand your use case. Just run ./gradlew -Pci --console=plain clean lint assembleRelease publishApk --stacktrace
  2. Dang
  3. Can you share the logs from the Gradle build?
  4. Also dang
  1. Do I understand this correctly, publishApk will build the APK again, right after the assembleRelease? If yes, I am not willing to build again, it alters the SHA of the APK file.

I can share the logs, sure. Could you provide the exact command with which you would like the logs to be shared? For example, --debug or others?

Nope, that would be horrible UX. If you run any publishing task within the same build as an assemble task, assembly will only run once. This is how Gradle works BTW and isn't related to GPP: a task can only run once per build invocation.

I'm begging you at this point, just remove artifactDir. It'll work as you expect, trust me. 馃槢 However, I would like to get to the bottom of the bug, so can you run ./gradlew publishApk --info > logs.txt and upload the file?

Sidenote: clearly the docs need fixing. Does this make more sense?

Yes, sure. For some reason, this morning my account has been suspended, so I cannot really get you the gradle build info currently, so if you are not in a rush, let's wait and I'll get you the logs.

As per the documentation, I would write like this:

By default, GPP will not build your artifact unless it absolutely has to (e.g. in case there is no artifact available). In advanced cases, this might not be the desired behavior.

Oof, sorry to hear that about your account being suspended. And thanks for your thoughts on the documentation, it gave me an idea which I think is as simple as possible without the confusion you ran into.

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ironjan picture ironjan  路  3Comments

aat-antoine picture aat-antoine  路  6Comments

Sloy picture Sloy  路  3Comments

kristiyanP picture kristiyanP  路  4Comments

ToxicBakery picture ToxicBakery  路  4Comments