I answered this also on this question, but I figured I'd add the same comment here. Let me know if that's the wrong way to do this (duplicating answers).
I was able to create a gradle plugin that does the publishing to any track you wish for any flavor/variant you wish using the new Google Play Publishing APIs.
See the sources here: https://github.com/bluesliverx/savillians-gradle
I'm working on publishing this to maven central so it can be used in a build script, but for now you can grab the android-publisher
subdirectory in the repo, put it in the root of your gradle build, and rename the folder to buildSrc
. Use the following line in the build.gradle
file for the android project you want to publish:
apply plugin: com.savillians.gradle.androidpublisher.AndroidPublisherPlugin
You can then set your publishing settings using an androidPublisher
block in the build.gradle file.
android {
...
}
androidPublisher {
applicationName = "Company-Name-Product-Name/1.0"
packageName = "<package name>"
serviceAccountEmail = "<service account email>"
serviceAccountKeyFile = file('<p12 keyfile - NOT the json file>')
track = "alpha" // default, don't need to specify
variantName = "release" // default, don't need to specify
}
Make sure the service account you create has "release manager" permissions, download the p12 key file and put it in the project's directory. Then run this command:
gradle androidPublish
That will send it to Google Play using the credentials you specified. Good luck and let me know if you have questions since this is brand new.