This guide dives into leveraging Fastlane for updating and managing Google Play store listings and screenshots, tailored for developers familiar with Android app development but new to Fastlane. If you are new to Fastlane, I suggest you to read my first post on Fastlane for Android.

Setting Up Your Google Developers Service Account

  1. Access the Google Play Console: Navigate to the Google Play Console and locate the “Account Details” section. Note the Developer Account ID listed there for future reference.
  2. Enable the Google Play Developer API: If you already have a Google Cloud Project that suits your needs, select it to enable the Google Play Developer API. Otherwise, create a new project here and follow the instructions to set it up.
  3. Open Service Accounts on Google Cloud: Within the Google Cloud Platform, select the project you wish to use for Fastlane. Navigate to the “Service Accounts” section.
  4. Create a New Service Account: Click the “CREATE SERVICE ACCOUNT” button. Ensure you’re working under the correct Google Cloud Platform Project by verifying the Developer Account ID or project name.
  5. Configure the Service Account Details: Provide a name for the service account (e.g., “fastlane-supply”) and copy the generated email address for later use. Conclude the creation process by clicking “DONE”.
  6. Manage Keys for the Service Account: Find the newly created service account in the list, click on the vertical three-dot icon for actions, and select “Manage keys”. Add a new key by selecting “ADD KEY” → “Create New Key”, ensuring the key type is JSON. Save the generated JSON file securely.
  7. Configure Access in Google Play Console: With the service account email address copied, go to the Google Play Console’s “Users and Permissions” section to invite this new user. Paste the service account’s email and configure the desired permissions. Admin (all permissions) is recommended, but you may customize this as needed.
  8. Testing and Integration with Fastlane: Use the command fastlane run validate_play_store_json_key json_key:/path/to/your/downloaded/file.json to test the connection with the Google Play Store. Upon successful connection, add the path to the JSON key file to your Fastlane Appfile like so:
json_key_file("path/to/your/play-store-credentials.json")
package_name("my.package.name")

This path should be relative to where you usually execute Fastlane commands.

Publishing

Publishing to the Production Track

Deploying your app to the production track means it will be available to all users on Google Play.

lane :deploy_to_play_store do
  gradle(task: "assembleRelease")
  upload_to_play_store(track: 'production')
end

Execute fastlane deploy_to_play_store to start the deployment process.

Publishing to the Beta Test Track

You can also use Fastlane to publish to another track, like alpha, beta or internal testing tracks.

lane :deploy_to_beta do
  gradle(task: "assembleBeta")
  upload_to_play_store(track: 'beta')
end

Execute fastlane deploy_to_beta to push your app to beta testers.

Managing Store Listings and Screenshots

Fetching Current Store Listings

fastlane supply init

Screenshots and listings will be downloaded in fastlane/metadata/android directory, including app description, “what’s new” section and all other store info. I reccomend to add the fastlane/metadata/android directory to git, in order to track changes to store details.

Updating Store Listings and Screenshots

Now you can edit metadata and screenshots in the fastlane/metadata/android directory, then run:

fastlane supply --apk path/to/apk --track beta

to upload updated data to Play Store.

References