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.13k stars 341 forks source link

APK uploaded: apk not visible in Play console #946

Closed ablair-or closed 3 years ago

ablair-or commented 3 years ago

I'm publishing my app's APK, and publishing appears to go fine -- the APK is marked as being uploaded, with percentages printed out, and then the publish task completes successfully. When I then look for the version of the APK in Play console, I don't see anything that wasn't there before.

android/build.gradle:

plugins {
    // v2.7+ require a newer version of gradle than we have.
    id("com.github.triplet.play") version "2.6.2"
}

android/app/build.gradle:

apply plugin: 'com.github.triplet.play'
...
android {
    defaultConfig {
        applicationId 'com.mydomain.myapp'
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode  10060
        versionName  "1.0.60"
    }
    buildTypes {
        releasebeta {
            initWith release
            applicationIdSuffix ".beta"
            matchingFallbacks =  ['release']
        }
        release {
            signingConfig signingConfigs.jenkins
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
    }
}

play {
    //serviceAccountEmail = "commented-out"
    // Google service account credentials provided by Jenkins
    def credentials_json = System.getenv('PLAY_STORE_SERVICE_ACCOUNT')
    if (credentials_json && file(credentials_json).exists()) {
        serviceAccountCredentials = file(credentials_json)
        enabled = true
    }
    else {
        // java.lang.IllegalStateException: PKCS12 credentials must specify a service account email.
        // java.lang.IllegalStateException: No credentials specified. Please read our docs for more details
        enabled = false
    }
    track = "internal"
    releaseStatus = "draft"
    // resolutionStrategy = "ignore"

    // Do not commit version number(?) changes to git checkout
    commit = false

    // Note: all artifacts in the specified directory will be published.
    //   (not just the latest-built APK)
    //artifactDir = file("android/app/build/outputs/apk/" + applicationId)
}

I first created an Internal testing release, and added a v1.0.10 APK to the release (just to have something -- same behavior when I have no releases and no APKs in the library.)

Output,

$ android/gradlew  -p android publishReleasebeta
...
> Task :app:publishReleasebetaApk
Starting APK upload: android/frontend/oride/native-app/android/app/build/outputs/apk/releasebeta/app-releasebeta.apk
Uploading APK: 31% complete
Uploading APK: 61% complete
Uploading APK: 92% complete
APK upload complete
Updating [draft] release (com.mydomain.myapp.beta:[10060, 10010]) in track 'internal'

At this point, I expect there to be an APK in my App bundle explorer. I expect it to be App version 10060.apk. Instead, I see only App version 10010.apk in App bundle explorer. In the internal testing, nothing has changed for the release (when I edit the release, it still shows app 10010 (1.0.10).) In Production, I'm offered a button, "Create new release".

Is there something I'm missing?

SUPERCILEX commented 3 years ago

Right, you've uploaded it as a draft which means it doesn't go anywhere. Just remove this line releaseStatus = "draft"

ablair-or commented 3 years ago

I changed to,

play {
    // Google service account credentials provided by Jenkins
    def credentials_json = System.getenv('PLAY_STORE_SERVICE_ACCOUNT')
    if (credentials_json && file(credentials_json).exists()) {
        serviceAccountCredentials = file(credentials_json)
        enabled = true
    }
    else {
        // java.lang.IllegalStateException: PKCS12 credentials must specify a service account email.
        // java.lang.IllegalStateException: No credentials specified. Please read our docs for more details
        enabled = false
    }
    track = "internal"
    //releaseStatus = "draft"
    // resolutionStrategy = "ignore"

    // Do not commit version number(?) changes to git checkout
    commit = false

    // Note: all artifacts in the specified directory will be published.
    //   (not just the latest-built APK)
    //artifactDir = file("android/app/build/outputs/apk/" + applicationId)
}

-- commented it out. Rerun the build,

$ android/gradlew  -p android/ PublishReleasebeta
> Task :app:publishReleasebetaApk
Starting APK upload: android/app/build/outputs/apk/releasebeta/app-releasebeta.apk
Uploading APK: 31% complete
Uploading APK: 61% complete
Uploading APK: 92% complete
APK upload complete
Updating [completed] release (com.mydomain.myapp.beta:[10060]) in track 'internal'

> Task :app:publishReleasebetaListing
Uploading en-US listing
Uploading app details

> Task :commitEditForComDotMydomainDotMyappDotBeta
Changes pending commit

and now... no change. App bundle explorer shows one app version, 10010 (1.0.10), file type APK. The internal testing has one release (Draft), with associated apk version 10010. Production has no releases (blue button: Create new release).

Is the track correct? I'd love it to go to production, but one thing at a time.

SUPERCILEX commented 3 years ago

Remove commit = false. Please don't use options you don't understand.

ablair-or commented 3 years ago

That's it! thanks very much. :-)

I guess I was looking for a way to prevent it from doing a git commit,

$ git log
commit b55d54ed18f7b6389aaa643596d9d9fc955ff655
Date:   Tue Apr 27 14:13:03 2021 -0400
    v1.0.60

Misunderstanding aside, is there a way to stop GPP from committing to git after uploading?

With commit not set false, it uploads the APK, so I've got a path forward. Thank you very much!

SUPERCILEX commented 3 years ago

The commit flag has nothing to do with git, it controls whether the play store changes should be applied/committed: https://developers.google.com/android-publisher/api-ref/rest/v3/edits/commit