Google Play Tool
This is a tool uploading bundles to the Google Play console from the command line. It makes use of the Google Play Developer API.
Introduction
This tool is intended to enable you to automatically upload Android .aab bundle files to the Google Playstore as part of your automated build process. The goal is something similar to the xcrun altool tool for iOS. It has some additional features to allow you to list the existing versions and the available test tracks.
Run gplay --help to see the available options. After your build completes you'll do something like this:
The tool uses the simple upload model, so you will need to increase the timeout for large bundle files.
Setup
This tool uses the Google Play Android Developer API in Google Cloud to upload new bundle builds. Setting up Google Cloud is a bit overwhelming.
It is important to note how Google app versioning. While your app should have a semantic version (major, minor, patch) each build also needs to have a unique integer version number across all releases of the app. You cannot upload the same build version more than once. Also, it seems that build numbers can be uploaded in any order, they just need to be unique. You'll need to figure out how this works in the context of your build system.
Here is a general summary of the steps you will need to take.
- Go to Google Accounts and set up an account
- Go to the Google Play Console and set up a developer account
- Create your app, making a note of the package name, e.g. com.yourname.yourapp
- Upload build number
1manually. If anyone from Google is reading this, this is an annoying restriction and should be fixed. - Go to the Google Cloud Console and enable the Google Play Android Developer API
- Create a service account in the Google Cloud Console
- Generate and download a
.jsoncontaining the login credentials. Put it somewhere safe andchmod o=to make sure only you have access. - Add the service account as a user in the Play Console. Give it all Releases permissions.
- Test everything out by running a
gplay list-bundlescommand.
Once this is done you can use the upload sub-command to upload your binaries to publish a new build to a given test track. Then you can go to the Play Console UI and move the build through the release tracks as needed.
Suggested Enhancements
Pull requests welcome for the following features:
- Support for re-startable uploads
- More Android Publisher API's support
- Refactoring to improve the code
- Support for other methods of authentication