marc walter

Setting up fastlane to push app releases to the Google Play Store


After building releases for F-Droid was done, I set off to make releases for Google Play easier.

Again, using WSL Ubuntu on Windows 10 by following the instructions from raveesh-me for Ubuntu 18.04:


Install ruby and ruby-dev headers

sudo apt install ruby ruby-dev

Set environment language variables Add these lines to the top of ~/.profile

export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8

Check that you didn't break the environment and execute source ~/.profile in the terminal. If no output, you are safe. Otherwise, check for what you broke in the .profile file

Install fastlane

sudo gem install fastlane -NV

Then continue with the fastlane instructions.

Go to the app folder and then run

fastlane init

Which will ask for the package name, in my case de.mw136.tonuino and then for an Google Play Store supply token. I skip this for now by pressing enter (will set this up later). Then press 'y' to generate the files fastlane/Appfile and fastlane/Fastfile.

Run the tests using fastlane

I tried to run fastlane test, but it told me to use bundle exec fastlane test instead because it is supposed to be faster.
Then there were two errors, so I had to execute the following before:

# Must have executing rights on gradlew
chmod u+x gradlew
# It uses a different variable to search for the Android SDK, so it needs to be set
# build the app and run the tests
bundle exec fastlane test

Configure supply to publish to the Google Play Store

Copy of official doc

Collect Google credentials

Tip: If you see Google Play Console or Google Developer Console in your local language, add &hl=en at the end of the URL (before any #...) to switch to English.

  1. Open the Google Play Console
  2. Click the Settings menu entry, followed by API access
  3. Click the CREATE SERVICE ACCOUNT button
  4. Follow the Google Developers Console link in the dialog, which opens a new tab/window:
    1. Click the CREATE SERVICE ACCOUNT button at the top of the Google Developers Console
    2. Provide a Service account name
    3. Click Select a role and choose Service Accounts > Service Account User
    4. Click CREATE KEY
    5. Make sure JSON is selected as the Key type
    6. Save the JSON credentials file
  5. Back on the Google Play Console, click DONE to close the dialog
  6. Click on Grant Access for the newly added service account
  7. Choose Release Manager (or alternatively Project Lead) from the Role dropdown. (Note that choosing Release Manager grants access to the production track and all other tracks. Choosing Project Lead grants access to update all tracks except the production track.)
  8. Click ADD USER to close the dialog

Configuration and initial run

Edit fastlane/Appfile and change the json_key_file line to have the path to your credentials file.


fastlane supply init

Then I made some more changes to fastlane/Fastfile, e.g. added environment variables to supply passwords for the signing process

Then it is possible to build a release using

bundle exec fastlane beta


To verify that the signing process was successful:

~/android/build-tools/latest/apksigner verify -v app/build/outputs/apk/release/app-release.apk

Verify the version code (upload to google will fail if it is the same)

~/android/tools/bin/apkanalyzer manifest version-code  app/build/outputs/apk/release/app-release.apk