New to fastlane? Click here to open the installation & setup instructions first

1) Install the latest Xcode command line tools

xcode-select --install

2) Install fastlane

# Using RubyGems
sudo gem install fastlane -NV

# Alternatively using Homebrew
brew install fastlane

3) Navigate to your project and run

fastlane init

More Details

Deploy to Google Play using fastlane

Building your app

fastlane takes care of building your app by delegating to your existing Gradle build. Just add the following to your Fastfile:

lane :playstore do
  gradle(
    task: 'assemble',
    build_type: 'Release'
  )
end

Try running the lane with:

fastlane playstore

When that completes you should have the appropriate APK ready to go in the standard output directory. To get a list of all available parameters for the gradle action, run:

fastlane action gradle

Uploading your APK

To upload your binary to Google Play, fastlane uses a tool called supply. Because supply needs authentication information from Google, if you haven't yet done the supply setup steps, please do those now!

With that done, simply add a call to supply to the lane you set up above:

lane :playstore do
  gradle(
    task: 'assemble',
    build_type: 'Release'
  )
  upload_to_play_store # Uploads the APK built in the gradle step above and releases it to all production users
end

This will also:

  • Upload app metadata from fastlane/metadata/android if you previously ran fastlane supply init
  • Upload expansion files (obbs) found under the same directory as your APK as long as:
    • They are identified by type as main or patch by containing main or patch in their file names
    • There is at most one of each type
  • Upload screenshots from fastlane/metadata/android if you previously ran screengrab
  • Create a new production build
  • Release the production build to all users

If you would like to capture and upload screenshots automatically as part of your deployment process, check out the fastlane screenshots for Android guide to get started!

To gradually roll out a new build you can use:

lane :playstore do
  # ...
  upload_to_play_store(
    track: 'rollout',
    rollout: '0.5'
  )
end

To get a list of all available parameters for the upload_to_play_store action, run:

fastlane action upload_to_play_store