Flutter is a mobile app SDK that allows developers to create native apps for both iOS and Android. Bitrise supports Flutter apps: we have dedicated Steps to help you with all your Flutter needs. This guide walks you through setting up, testing, building and deploying a simple Flutter app on Bitrise.
Adding a Flutter app ⚓
- Click the + sign on the top menu bar and select Add app, which takes you to the Create New App page.
- Choose the account you wish to add the app to.
- Set the privacy of the app to either Private or Public and click Next.
- Select the Git hosting service that hosts your repository, then find and select your repository that hosts the project. Read more about connecting your repository.
- When prompted to set up repository access, click No, auto-add SSH key. Read more about SSH keys.
- Type the name of the branch that includes your project’s configuration - master, for example - then click Next.
Wait while Bitrise is validating your project.
We look for your configuration files and set up your app based on them. In the case of Flutter apps, you definitely need a
pubspec.yamlfile in your project.
If your app has tests in the repository, you will be prompted to decide if you want to run them.
If you have an iOS project in your Flutter project, you will have to select an .ipa export method.
Register a webhook when prompted.
With a webhook, Bitrise can start a build automatically when code is pushed to your repository, or a pull request is created. This also kicks off your first build - click the message and it will take you to the build page.
Testing a Flutter app ⚓
You can write and run unit-, widget-, and integration tests with Flutter. For more information, check out Flutter’s official documentation.
You can use our automatically generated primary Workflow to test your Flutter app. By default, it will include the Flutter Analyze Step which runs static code tests.
- Open your app’s Workflow Editor and open the primary Workflow.
In the Flutter Install Step, fill in the Flutter SDK Version input.
You can specify either tags or branches of the Flutter SDK’s git repository. The default value is
stable. This will use the latest stable branch of Flutter.
To the Flutter Analyze Step, add any flags you wish to use to the Additional parameters input.
The Step runs the
flutter analyzecommand with the specified flags. To check the available flags, open a command line interface on your own machine and run
flutter analyze --help.
To the Flutter Test Step - if you have it -, add any flags you wish to use to the Additional parameters input.
The Step runs the
flutter testcommand with the specified flags. To check the available flags, open a command line interface on your own machine and run
flutter test --help.
Make sure the Project Location input of the Flutter Test Step is correct.
The default value is the the Environment Variable (Env Var) created for your Flutter project’s location.
Run a build! Once it’s done, you can find your test results on the APPS & ARTIFACTS tab of the Build’s page of the app.
Deploying a Flutter app ⚓
To build and deploy a Flutter app, a Workflow must contain these Flutter Steps:
- Flutter Install
- Flutter Build
If you have platforms specified in your repository, a deploy Workflow will be automatically generated when adding the app on Bitrise. The content of this Workflow depends on the platforms: for example, if your app contains only an iOS project, the Workflow will contain the Certificate and profile installer and the Xcode Archive & Export for iOS Steps.
You can build both iOS and Android projects at the same time or you can build them separately, each using their own Workflow. You can set this in the Platform input of the Flutter Build Step any time. By default, the Step is configured according to the platform or platforms that the scanner detected when adding the app on Bitrise.
Here’s an example Workflow we’ll use in this configuration, with all the necessary Steps:
We’ll discuss the Steps specific to iOS and Android deployment in their respective sections!
Deploying a Flutter app to Bitrise ⚓
The Deploy to bitrise.io Step uploads all the artifacts related to your build into the APPS & ARTIFACTS tab on your Build’s page.
You can share the generated APK/.ipa file with your team members using the build’s URL. You can also notify user groups or individual users that your APK/.ipa file has been built.
- Go to the Deploy to bitrise.io Step.
- In the Notify: User Roles, add the role so that only those get notified who have been granted with this role. Or fill out the Notify: Emails field with email addresses of the users you want to notify. Make sure you set those email addresses as secret Env Vars! These details can be also modified under Notifications if you click the eye icon next to your generated APK/.ipa file in the APPS & ARTIFACTS tab.
Deploying a Flutter app to App Store Connect ⚓
To deploy your iOS Flutter project to the App Store, you’ll need to build the app, export an .ipa file and submit it to the App Store.
Unlike testing, this requires code signing files:
- An iOS Distribution Certificate (a .p12 file).
- An App Store Provisioning Profile.
For Flutter applications, code signing requires setting a Team ID in the project settings in Xcode.
Read more about iOS code signing on Bitrise in our detailed guides!
Configuring Team ID for Flutter apps ⚓
Once you created your iOS project locally, you will need to review the project settings for it in Xcode. More specifically, you need to set a valid Team ID: without that, your build will fail on Bitrise.
- In Xcode, open Runner.xcworkspace in your app’s ios folder.
- To view your app’s settings, select the Runner project in the Xcode project navigator. Then, in the main view sidebar, select the Runner target.
- Select the General tab.
- In the Signing section, find the Team menu and set it to the team associated with your registered Apple Developer account.
Commit the change to your repository!
This is very important: if you only set the Team ID locally, your build will still FAIL on Bitrise!
Configuring deployment on Bitrise ⚓
- Make sure you have the Certificate and profile installer Step in your Workflow.
- Upload the required code signing files to Bitrise.
- Open the Flutter Build Step and find the iOS Platform Configs input group.
- Make sure the Additional parameters input has the value
- Check the Platform input of the Step: make sure it’s set to either
Make sure you have the Xcode Archive & Export for iOS Step in your Workflow.
It should be after the Flutter Build Step.
- Set the Select method for export input of the Step to app-store.
- Add the Deploy to iTunes Connect Step to the end of the Workflow.
- Provide your Apple credentials in the respective input fields.
- Apple ID
- password or, if you use two-factor authentication on iTunes Connect, your application password.
Don’t worry, the password will not be visible in the logs or exposed - that’s why it is marked SENSITIVE.
- Start a build!
If all goes well, the Step will submit the app to App Store Connect. You can, from the App Store Connect page, distribute the app to external testers via Testflight, or release it to the App Store itself.
Deploying a Flutter app to Google Play ⚓
To deploy your app to Google Play, you need to export an APK or and App Bundle file and sign it.
You can configure the signing in the app’s
build.gradle file and then Flutter will sign your app during the build phase.
In this guide, we’ll walk you through the other option: how to sign your APK file on Bitrise and then deploy the app to Google Play.
- Open your app’s Workflow Editor.
- Go to the Code Signing tab.
- Drag-and-drop your keystore file to the ANDROID KEYSTORE FILE field.
- Fill out the Keystore password, Keystore alias, and Private key password fields and click Save metadata.
Once that is done, you are ready to configure a Workflow to deploy the app.
Before you’d use the Deploy to Google Play Step, make sure you have performed the following tasks:
- Upload the first APK manually to Google Play using the Google Play Console.
- Link your Google Play Developer Console to an API project.
- Set up API Access Clients using a service account: Please note when you create your service account on the Google Developer Console, you have to choose
jsonas Key Type.
- Grant the necessary rights to the service account with your Google Play Console. Go to Settings, then Users & permissions, then Invite new user. Due to the way the Google Play Publisher API works, you have to grant at least the following permissions to the service account:
- Access level: View app information.
- Release management: Manage production releases, manage testing track releases.
- Store presence: Edit store listing, pricing & distribution.
- As an optional step, you can add translations to your Store Listing. To allow the Deploy to Google Play Step to assign your
whatsnewfiles to the uploaded APK version, visit the Translate & localize your app guide and add translations to your Store Listing section.
Now let’s head back to Bitrise and finish off the deploy configuration of your Android app! You can deploy an APK or an App Bundle by building the right output type with the Flutter Build Step.
- In your Bitrise Dashboard, go to the Code Signing tab and upload the service account JSON key into the
GENERIC FILE STORAGE.
- Copy the env key which stores your uploaded file’s url. For example:
- Make sure you have the Android Sign Step in your Workflow. It should be after the Flutter Build Step.
- Open the Flutter Build Step and check the Platform input of the Step: make sure it’s set to either
- Find the Android Platform Configs input group.
- Make sure the Additional parameters input has the value
- In the Android output artifact type input field, select either
appbundledepending on your deployment requirements.
- Provide the path from which you want to copy the generated APK or App Bundle to get deployed by the Deploy to Google Play Step.
- Make sure you have the Deploy to Google Play Step after the Android Sign Step to your Workflow.
- Fill out the required input fields as follows:
- Service Account JSON key file path: This field can accept a remote URL so you have to provide the Env Var which contains your uploaded service account JSON key. For example:
- Package name: the package name of your Android app
- Track: the track where you want to deploy your APK (for example, alpha/beta/rollout/production or any custom track you set)
And that’s it! Start a build and release your Android app to the Google Play Store.
Deploy an app to Bitrise to be able to download the .ipa file and install it on devices specified in the app's Development Provisioning Profile. This way, your internal testers...
You can build and deploy your iOS application to a simulator, to show it off in a browser, for example. On Bitrise, we have a dedicated Step to build for...
In this guide we discuss how to set up, test, code sign and deploy your React Native project built with the Expo CLI.