Skip to content

Instantly share code, notes, and snippets.

@Mercandj
Last active August 10, 2020 18:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mercandj/e5b71bc652f488b6a31bb6ab9b8cbdff to your computer and use it in GitHub Desktop.
Save Mercandj/e5b71bc652f488b6a31bb6ab9b8cbdff to your computer and use it in GitHub Desktop.
Android: Upload AppBundle on the PlayStore via CLI

Android: Upload AppBundle on PlayStore

Goal:

Upload AppBundle on the PlayStore via the termial. Based on the Google API Publisher v3.

Process:

  • Be sure to have Java installed
  • Be sure to have your AppBundle file .aab
  • Be sure to have setup the PlayStore of your app to publish AppBundle (upload the keystore or let Google manager it)
  • Download the secret json file to authentify you to the PlayStore. How to get the json secret file:
    • (1) Go to https://play.google.com/apps/publish.
    • (2) Go to "Settings" > "Developer account" > "API access" > "OAuth Clients".
    • (3) Click "Create OAuth Client" otherwise if already created click "View in Google Developers Console".
    • (4) Click on one of the "OAuth 2.0 Client IDs"
    • (5) Click "Download JSON" as play-store-authentication.json
  • Replace arguments and run this command on the terminal. (arguments explained below)
# Download the play_store.jar if not previously downloaded: tool to upload.
if [ ! -f ./play_store.jar ]; then
     curl -L https://github.com/Mercandj/play-store-cmd/releases/download/2020_08_10/play_store.jar \
          --output play_store.jar
fi

# Run the jar with arguments.
java -jar ./play_store.jar app-bundle-upload \
          --application-name my_team-fake_app/1.0 \
          --application-package com.example.my_great_fake_app \
          --app-bundle ./1_00_00_fake_app.aab \
          --secret-file ./play-store-authentication.json
Argument Presence Description
--application-name Required The name of the application. You can put whatever you want.
Google code suggests "MyCompany-Application/1.0"
--application-package Required Easy, your app package name
--app-bundle Required App bundle file path
--secret-file Required Json OAuth 2.0 file path
--track Optional default: internal PlayStore's channel of distribution.
- internal
- alpha
- beta
- production
--rollout-percentage Optional default: 1.0 Rollout percentage between 0.0 and 1.0

Side notes:

  • The first run of this Jar will open your web-browser to ask you to login with your Google Account
  • Authentication is stored in ~/.store/android_publisher_api (if you want to change your account then delete this folder)
  • The version created in the PlayStore console will be the version name of the AppBundle
  • The changlog of your new version will be empty
  • Multi app bundle files for the same version not supported
  • Apk not supported
  • The Jar is not open source yet 😢 but it's not minified so you can read the code easily 💪😄

Thank you:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment