Painless releases with fastlane and Flutter

Making releases is a painful and time consuming task. While some of the tasks still need to be manual, some can be automated or reduce to a simple shell command.

At Tengio, we’ve been working on a few Flutter projects in the last few months and we’ve been following this procedure:

  1. Create a build

  2. Upload the build to Play Store internal track and TestFlight

  3. Release to internal testers and developers for QA

  4. Finally, promote release to a wider range of selected people

Using flutter and fastlane we have automated step 1 and 2. This is how we have done it.


“fastlane is the easiest way to automate beta deployments and releases for your iOS and Android apps.”

To install fastlane you use brew cask install fastlane.

Add fastlane to your shell profile: export PATH=$HOME/.fastlane/bin:$PATH.

Android releases with Play store

Google Play release management has now 4 types of releases: - Internal - Closed - Open - Production

In our setup we use fastlane to upload a new release to the internal track. Only when manual QA has been run on it, the release is promoted to internal and shared with a bigger audience of selected people.

Initialize Android fastlane

  1. Ensure your flutter project runs properly : flutter build apk

  2. Init fastlane : (cd android && fastlane init) (use same package name as the one in the pubspec.yaml)

  3. From Google Play console you need to download the service account Json key. This is necessary to give fastlane permission to access Google Play console. Details of the steps for fastlane supply setup

  4. Set the path to the json key file in the fastlane/Appfile

  5. Run (cd android && fastlane supply init) to fetch all the Google Play store metadata.

  6. Create a lane for internal upload by editing the fastlane/Fastfile file


platform :android do
  desc "Submit a new build to Internal Track on Play"
  lane :internal do
    supply(track: "internal", apk:"../build/app/outputs/apk/release/app-release.apk", rollout: "1.0")

NOTE apk parameter is necessary for flutter builds.

Release on Android

Release is reduced to two simple commands:

  1. flutter clean && flutter build apk

  2. (cd android && fastlane android internal)

iOS releases with TestFlight

TestFlight uses two type of testers: Internal and External. - Internal, are connected users on iTunes - External, are users outside your team that wants to test your app.

TestFlight builds are immediately, after a quick processing phase, available to Internal users. Releases are, instead, accessible to External users only after review which can take up to a day.

Initialize ios fastlane

  1. Ensure your flutter project runs properly : flutter build ios --no-codesign

  2. Init fastlane : (cd ios && fastlane init). You need to select app_identifier, apple_id, itc_team_id and team_id.

  3. Run (cd android && fastlane supply init).

  4. Create a lane for internal upload by editing the fastlane/Fastfile file with:


platform :ios do
  desc "Push a new beta build to TestFlight"
  lane :internal do
    build_app(workspace: "Runner.xcworkspace", scheme: "Runner")

NOTE: get_certificates, get_provisioning_profile are useful to ensure you have the correct xcode metadata for the build.

NOTE: You can additionally set a FASTLANE_PASSWORD in the shell.

Release on iOS

As for Android, the iOS release is now done with two simple commands:

  1. flutter clean && flutter build ios

  2. (cd ios && fastlane ios internal)


What’s next?

Continuous integration.

Luigi image


Luigi is a developer with years of experience in many types of projects and technologies.

comments powered by Disqus