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

Nothing to commit #700

Closed nscherer closed 5 years ago

nscherer commented 5 years ago

I don't know what kind of issue this should be, but I'm getting this message when running a publish task

gradlew publishMyFlavorReleaseApk

> Task :commitEditForMyDomainMyFlavor
Nothing to commit, skipping

and I can't find any information on the message. The task completes successfully, but nothing is published. Bootstrapping works so the app is on the play store, the plugin is connected and authenticated and all that.

SUPERCILEX commented 5 years ago

Right, because none of the tasks were generated since you probably have something wrong with signing, credentials, or enabled. Closing as duplicate of https://github.com/Triple-T/gradle-play-publisher/issues/699. Please read the README and fill out the issue template.

nscherer commented 5 years ago

This is not a duplicate of 699, they're completely unrelated. If you re-read this issue, you can see that I'm trying to run a single publish task, which has nothing to do with my other question. I have read the README, can you offer anything more specific? I'll fill out the template to the best of my ability (though it isn't compatible with Windows) for a bug issue type even though this is more of a question - I doubt it's a bug.

Describe the bug

I'm getting this message when running a publish task

gradlew publishMyFlavorReleaseApk

> Task :commitEditForMyDomainMyFlavor
Nothing to commit, skipping

How To Reproduce

This is what I did, I can't really say how to reproduce.

Versions

Tasks executed

What tasks did you run? For example, publishBundle. publishVariantNameApk

Expected behavior

The APK to be published to the Play Store

Additional context (if a crash, provide stack trace)

Add any other context about the problem here. If this bug is a crash, run the task with --stacktrace to get the full context._

SUPERCILEX commented 5 years ago

@nscherer it is related to the other issue because it means nothing was executed. Can you send the me the link outputted from running ./gradlew publishBundle --info --scan?

nscherer commented 5 years ago

I got this error:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:publishAgentResourceCompileOptionsBundle'.
> A failure occurred while executing com.github.triplet.gradle.play.tasks.PublishBundle$BundleUploader
   > 403 Forbidden
     {
       "code" : 403,
       "errors" : [ {
         "domain" : "androidpublisher",
         "message" : "For uploading an AppBundle you must be enrolled in Play Signing.",
         "reason" : "apkNotificationMessageKeyBundleRequiresPlaySigning"
       } ],
       "message" : "For uploading an AppBundle you must be enrolled in Play Signing."
     }

I'm not doing app bundles, only APKs. publishApk results in a GC overhead limit error, probably because I have so many flavors. Here's the result for just one build variant: https://gradle.com/s/tjkbtybvvsn3s

Thanks for taking a look.

SUPERCILEX commented 5 years ago

You clearly ran bundle publishing and it seems to have worked, so run ./gradlew app:publishAgentResourceCompileOptionsApk.

nscherer commented 5 years ago

I'm not sure what exactly that task would be publishing, but here's the result:

> Task :app:publishAgentResourceCompileOptionsApk FAILED

> Task :commitEditForComDotRedshedtechnologyDotTitle365
Build failed, skipping

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:publishAgentResourceCompileOptionsApk'.
> A failure occurred while executing com.github.triplet.gradle.play.tasks.PublishApk$Processor
   > There was a failure while executing work items
      > A failure occurred while executing com.github.triplet.gradle.play.tasks.PublishApk$ApkUploader
         > 403 Forbidden
           {
             "code" : 403,
             "errors" : [ {
               "domain" : "androidpublisher",
               "message" : "APK signature is invalid or does not exist. Error from apksigner: ERROR: JAR_SIG_NO_SIGNATURES: No JAR signatures",
               "reason" : "apkNotificationMessageKeyInvalidSignature"
             } ],
             "message" : "APK signature is invalid or does not exist. Error from apksigner: ERROR: JAR_SIG_NO_SIGNATURES: No JAR signatures"
           }

Perhaps related to my signing config?

signingConfigs {
        releaseConfig {
            storeFile file(keystoreProperties['keyStore'])
            storePassword keystoreProperties['keyStorePassword']
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyAliasPassword']
        }
    }
...
buildTypes {
        debug {
            minifyEnabled false
            applicationIdSuffix ".debug"
            versionNameSuffix " Dev"
        }
        qa {
            minifyEnabled false
            signingConfig signingConfigs.releaseConfig
            versionNameSuffix " Test"
        }
        release {
            minifyEnabled false
            signingConfig signingConfigs.releaseConfig
            zipAlignEnabled true
        }

        flavorDimensions "app" // Required by Gradle 3
    }
SUPERCILEX commented 5 years ago

https://stackoverflow.com/questions/44816305/upload-new-apk-to-alpha-failed

If you manage to publish something on the Play Store, then run the publishing task for that variant.

nscherer commented 5 years ago

I've published plenty on the Play Store manually if that's what you mean. I tried both of the suggestions on that question. Namely Build -> Generate signed APK which worked, and delete build folders. I even did them in both orders. I'm back where I started with "Nothing to commit, skipping" when running the task publishAgentResourceReleaseApk. There are warnings (errors?) about all the "CompileOptions" tasks that say "Signing not ready. Be sure to specify a signingConfig for variant [flavor]CompileOptions" but I have never had to specify anything about signing other than by build type (you can see how I'm doing that above). Is there somewhere I need to specify a signing configuration for every flavor, or another place to do it globally?

SUPERCILEX commented 5 years ago

Ah, so you're using Studio to generate the APK and don't actually know which variant is the correct one. Here's the plan:

  1. Add enabled = false to your play block:
    play {
       enabled = false
       // ...
    }
  2. Run ./gradlew clean
  3. Click through Build -> Generate signed APK
  4. Find the folder where the APK was generated, should be something like app/build/outputs/apk/XXX/*.apk
  5. Enable just that variant like this:
    android {
       // ...
       playConfigs {
           XXX {
               enabled = true
           }
       }
    }
  6. Run ./gradlew publishApk
nscherer commented 5 years ago

I'm quite aware of which variant I'm trying to publish, it's called AgentResourceRelease. Normally I do this from the command line like gradlew assembleAgentResourceRelease or more commonly all of them at once: gradlew assembleRelease. Anyway I updated my build file:

android {
// lots of other stuff
playConfigs {
        dataTrace {
            enabled = false // I am not planning to ever publish this particular flavor
        }
        agentResource {
            enabled = true
        }
    }
} 

play {
    serviceAccountCredentials = file("service-account-key.json")
    track = "production"
    enabled = false
}

Then I generated the APK, which worked fine, and ran publishApk, which didn't do anything. With debug output it says this toward the end:

08:43:17.528 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationExecutor] Build operation 'Task :app:publishApk' started
08:43:17.528 [INFO] [com.android.build.gradle.internal.profile.RecordingBuildListener] Task :app:publishApk in app Starting
08:43:17.528 [INFO] [org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter] Skipping task ':app:publishApk' as it has no actions.
08:43:17.528 [INFO] [com.android.build.gradle.internal.profile.RecordingBuildListener] Task :app:publishApk in app Finished

I can do another --scan if you want to see the whole thing. There is quite a bit of output. Thanks for your patience.

SUPERCILEX commented 5 years ago
nscherer commented 5 years ago

OK, I removed the agentResource enabled section, re-enabled play, and ran publishAgentResourceReleaseApk and I was back to the 500 error. I know that means Google rejected the request, and I figured out my key file was for the wrong service account. I don't know if you have any kind of weight with Google, I'm guessing not, but it sure would be nice if there were a meaningful error message returned instead of just a 500.

Anyway, it's working now! I'm still not sure why I ever got the nothing to commit problem, but at any rate all seems well now. Thanks very much for your help.

SUPERCILEX commented 5 years ago

I removed the agentResource enabled section

You should be able to have play.enabled = false and playConfigs { agentResourceRelease { enabled = true } } work (which is better for performance and static guarantees since you know only that one thing can be published).

I don't know if you have any kind of weight with Google

I've looked at the code, but I doubt I can share much. I will say that's it's unpleasant from a technical standpoint, so if you complain through support, they'll probably fix it eventually.

it's working now

🎉

nscherer commented 5 years ago

You should be able to have play.enabled = false and playConfigs { agentResourceRelease { enabled = true } } work (which is better for performance and static guarantees since you know only that one thing can be published).

A lot of the time I will want to publish all the flavors at once, so I don't want to be reconfiguring the build file all the time.

One more question I thought of if you don't mind: should I expect there to be a publishRelease or publishReleaseApk task that operates on all flavors? Because I have no such task, and based on your comment above maybe that is by design.

SUPERCILEX commented 5 years ago

I will want to publish all the flavors at once

Ah, I completely misunderstood your use case. I thought you had one and only one flavor that needed to be published.

should I expect there to be a publishRelease

Yes, there will always be a global version with optional cascades. The root publishing task publishes everything (which probably isn't what you want), the feature specific tasks publish APKs for example, the flavor specific task publishes everything for a given variant.

E.g. publishRelease maps to publishAgentResourceRelease. Or are you saying you want to publish all APKs for and only for the release build type? If so, why? (What's the difference between just publishing all APKs across everything?)

nscherer commented 5 years ago

I thought you had one and only one flavor that needed to be published.

That's what I was doing just to simplify tracking down the problems I was having.

Yes, I want to publish all APKs for the release build type. I generally use the Play Store only for production publishing, not testing, so I only want to publish release variants, not debug or qa (my other custom build type). The flavors are all white label variations of the same app, so generally I want to push them all out at once after QA testing is complete.

SUPERCILEX commented 5 years ago

I see, so that's where the playConfigs come in. You can either disable everything with play.enabled or selectively disable the qa build type. I would suggest something like this:

android {
  // ...
  playConfigs {
    release {
      enabled = true
    }
  }
}

play {
  // ...
  enabled = false
}

Then you'll be able to run ./gradlew publishApk.

nscherer commented 5 years ago

Ah great suggestion, thank you.