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.1k stars 340 forks source link

versionCode dissapears after using playConfigs #997

Closed smworks closed 3 years ago

smworks commented 3 years ago

Using latest version 3.6.0 I'm experiencing an issue.

When plugin is configured, I only see gradle option publishBundle, which doesn't seem to be doing anything. Since I want to be able to use different build types for publishing I added following code:

playConfigs { register("release") { enabled.set(true) } }

And even though this generated a proper gradle task for me to publish, It broke my code that generates ftp upload tasks. The reason for breaking ftp upload task generation code is that reference to variant.versionCode started throwing exceptions in following code:

android.applicationVariants.all { variant -> def versionCode = variant.versionCode // Crashes here }

Crash only happened on tasks that were using release build type. Exception:

org.gradle.api.UncheckedIOException: java.io.FileNotFoundException: /Users/user/Desktop/project/beta-temp/project_name/app/build/intermediates/gpp/playRelease/available-version-codes.txt (No such file or directory)

I don't see gpp folder in intermediates being generated

My build types:

My flavors:

Any ideas?

SUPERCILEX commented 3 years ago

Right, I'm assuming you have ResolutionStrategy.AUTO set somewhere? The file it's looking for contains the latest version codes. You'll want to have your upload task depend on process${taskVariantName}VersionCodes (you can find the available tasks by doing ./gradlew tasks --all | grep VersionCodes).

smworks commented 3 years ago

@SUPERCILEX , your assumption is spot on. I probably missed this bit while reading the documentation. I'm closing the issue. Thanks!