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.13k
stars
341
forks
source link
generateReleaseBuildConfig fails when resolutionstrategy is AUTO and versionCode > currently published version #899
When setting the versionCode to a value larger than what is currently published on the play store and with resolutionStrategy set to AUTO, publishing steps fail with an exception because the generateReleaseBuildConfig step fails (stacktrace at end).
My current published version is 22127. If I set versioncode to be less than 22127, the BuildConfig.java file is generated correctly with public static final int VERSION_CODE = 22128;. However, setting versioncode to be 22128 or higher gives a failure. It looks like the plugin assumes that the file generated by processReleaseVersionCodes (build/intermediates/gpp/release/available-version-codes.txt) is not empty, but running ./gradlew clean app:processReleaseVersionCodes produces an empty file here.
How To Reproduce
Set versioncode to be > currently published play store version
Attempt to run any gradle task that generates a release, e.g. assembleRelease
What tasks did you run? For example, publishBundle.
assembleReleasegenerateReleaseBuildConfig
Expected behavior
The BuildConfig.java should be correctly generated with the version code being the maximum of the gradle versionCode and the published versionCode, in this case, the gradle verisionCode.
Additional context (if a crash, provide stack trace)
* What went wrong:
Execution failed for task ':app:generateReleaseBuildConfig'.
> Failed to calculate the value of task ':app:generateReleaseBuildConfig' property 'versionCode'.
> Index: 0, Size: 0
* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:generateReleaseBuildConfig'.
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:38)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
at ...<snipped>
Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at com.github.triplet.gradle.play.PlayPublisherPlugin$applyInternal$2$2$10.transform(PlayPublisherPlugin.kt:353)
at com.github.triplet.gradle.play.PlayPublisherPlugin$applyInternal$2$2$10.transform(PlayPublisherPlugin.kt:59)
at org.gradle.api.internal.provider.TransformBackedProvider.mapValue(TransformBackedProvider.java:73)
at org.gradle.api.internal.provider.TransformBackedProvider.calculateOwnValue(TransformBackedProvider.java:65)
at org.gradle.api.internal.provider.AbstractMinimalProvider.calculateValue(AbstractMinimalProvider.java:103)
at org.gradle.api.internal.provider.MappingProvider.calculateOwnValue(MappingProvider.java:55)
at org.gradle.api.internal.provider.AbstractMinimalProvider.calculateValue(AbstractMinimalProvider.java:103)
at org.gradle.api.internal.provider.DefaultProperty.calculateValueFrom(DefaultProperty.java:128)
at org.gradle.api.internal.provider.DefaultProperty.calculateValueFrom(DefaultProperty.java:25)
at org.gradle.api.internal.provider.AbstractProperty.doCalculateValue(AbstractProperty.java:133)
at org.gradle.api.internal.provider.AbstractProperty.calculateOwnValue(AbstractProperty.java:127)
at org.gradle.api.internal.provider.AbstractMinimalProvider.calculateValue(AbstractMinimalProvider.java:103)
at org.gradle.api.internal.provider.AbstractMinimalProvider.withFinalValue(AbstractMinimalProvider.java:151)
at org.gradle.api.internal.provider.DefaultProperty.finalValue(DefaultProperty.java:133)
at org.gradle.api.internal.provider.DefaultProperty.finalValue(DefaultProperty.java:25)
at org.gradle.api.internal.provider.AbstractProperty.finalizeNow(AbstractProperty.java:236)
... 49 more
Describe the bug
When setting the versionCode to a value larger than what is currently published on the play store and with
resolutionStrategy
set toAUTO
, publishing steps fail with an exception because thegenerateReleaseBuildConfig
step fails (stacktrace at end).My current published version is 22127. If I set versioncode to be less than 22127, the
BuildConfig.java
file is generated correctly withpublic static final int VERSION_CODE = 22128;
. However, setting versioncode to be 22128 or higher gives a failure. It looks like the plugin assumes that the file generated by processReleaseVersionCodes (build/intermediates/gpp/release/available-version-codes.txt
) is not empty, but running./gradlew clean app:processReleaseVersionCodes
produces an empty file here.How To Reproduce
assembleRelease
Versions
Tasks executed
What tasks did you run? For example,
publishBundle
.assembleRelease
generateReleaseBuildConfig
Expected behavior
The
BuildConfig.java
should be correctly generated with the version code being the maximum of the gradle versionCode and the published versionCode, in this case, the gradle verisionCode.Additional context (if a crash, provide stack trace)