Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception with auto resolution when no conflict #879

Closed
mattprecious opened this issue Nov 2, 2020 · 4 comments
Closed

Exception with auto resolution when no conflict #879

mattprecious opened this issue Nov 2, 2020 · 4 comments
Labels
bug Indicates an unexpected problem or unintended behavior feature:apk Involves APKs feature:bundle Involves app bundles
Milestone

Comments

@mattprecious
Copy link

Describe the bug

We manually bumped the minor version of our app and now the publisher is throwing an IndexOutOfBoundsException when trying to resolve the version.

How To Reproduce

Manually change the version code to a non-conflicting version, and set:

resolutionStrategy = com.github.triplet.gradle.androidpublisher.ResolutionStrategy.AUTO

Versions

  • Gradle Play Publisher: 3.0.0
  • Gradle Wrapper: 6.7
  • Android Gradle Plugin: 4.1.0

Tasks executed

publishInternalReleaseBundle

Expected behavior

No exception.

Additional context (if a crash, provide stack trace)

Caused by: java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
	at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
	at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
	at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:248)
	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)

It seems like the version codes files is empty or non-existent.

@mattprecious mattprecious added the bug Indicates an unexpected problem or unintended behavior label Nov 2, 2020
@SUPERCILEX
Copy link
Collaborator

Oh shoot, I'm guessing this line is the culprit:

if (patch > 0) outputLines.append(default + patch.toInt() + i).append("\n")

I think you should be able to fix the crash by bringing the version code back to one: android { versionCode = 1 }. Does the fix the crash? If not, can you share what you changed in the build.gradle?

@mattprecious
Copy link
Author

I manually published version 3280000 (3.28.0.0) to the store and ran our automated deploy job again and it successfully published 3280001.

@SUPERCILEX SUPERCILEX added feature:apk Involves APKs feature:bundle Involves app bundles labels Nov 3, 2020
@SUPERCILEX
Copy link
Collaborator

Ok, good to hear the crash is gone. I'll just have to fix that if statement.

@SUPERCILEX SUPERCILEX added this to the 3.1.0 milestone Dec 2, 2020
@mrbipbip
Copy link

mrbipbip commented Dec 6, 2020

+1 here.
I have the same issue at the same line (saw it in build-scan).

In my case, i'm using Gitlab to set my version code dynamically like below:

android {
    setVersionCode((System.getenv("CI_PIPELINE_IID") ?: "1").toInt())
    setVersionName("1.0.0")
    ...
}

Its works when i remove:
resolutionStrategy.set(ResolutionStrategy.AUTO)

Note that:

onVariantProperties {
        for (output in outputs) {
            val processedVersionCode = output.versionCode.map { playVersionCode ->
                "${output.versionName}_$playVersionCode"
            }
            output.versionName.set(processedVersionCode)
        }
    }

Seems to write wrong info when uploaded to the Google Play Store (internal)
227 (property(java.lang.String, map(java.lang.String map(property(java.lang.Integer, fixed(class java.lang.Integer, 227))) check-type()))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior feature:apk Involves APKs feature:bundle Involves app bundles
Projects
None yet
Development

No branches or pull requests

3 participants