How to Distribute Your Flutter Project Using Firebase App Distribution
From this guide, you’ll learn how to set up CI/CD for Flutter with the help of Fastlane and Firebase App Distribution.
Join the DZone community and get the full member experience.Join For Free
Firebase recently launched the alternative to TestFlight and Fabric. Many developers are trying this tool out and so am I. Having worked with it for a while, I decided to show you how to set it up.
From this short guide, you’ll learn how to set CI/CD for Flutter using Fastlane and Firebase App Distribution.
Note: To understand everything that happens here, you should know how to set up Flutter and how to plug in Firebase. On top of that, this guide describes how to build a project for Android and iOS. So, you’ll need macOS for these tasks.
1. Installing Flutter
The first thing to do is to install Flutter.
Then, you should create a Flutter project and a project in Firebase Console.
Now, it’s time to dive into the package manager. Follow this link and install the latest version.
Use the following line:
After the command is executed, you’ll get the following message:
The next step is to execute the specified command. The last command may differ depending on the macOS version.
For Catalina, if you need to have Ruby first in your
Or you can open your .zshrc file and add the following lines:
Here is how my file looks like after that:
2. Installing Fastlane
Type the following command to install Fastlane:
Open the specified file and add there:
In my case, the installation wasn’t a success and I got installed the 2.28.3 version instead of the latest. I turned to this issue to solve my problem.
I tried two options and installed everything successfully following the instruction.
You can also download a ZIP file here.
Setting Up Fastlane
It’s also possible to use Gradle for Android, but it’s better to use Fastlane for iOS.
Getting Started With Android
Open your Flutter project in the console and go to the Android folder using this command:
As you see, you should type the name of a package. You can find it in the following file:
Just press Enter and wait until the full initialization of Fastlane.
In the end, you’lol see that Fastlane created the following files:
The next thing you should do is set up Firebase App Distribution following this instruction.
If you see the list of your projects after executing the final command, it means that everything works just fine.
Change your Fastfile file to:
Then, create a file in the Fastlane folder and name it .env.default.
APPID is the ID of your project in Firebase.
And run the command:
If you don’t have Java 8 installed, you can download it from Oracle website.
Or use the following commands:
Once everything is completed, you’ll see the build in the Firebase console and the following inscription in terminal:
Getting Started With iOS
Open the terminal and enter:
Then, enter your Apple ID and two-factor authorization code, if any.
Create a file in the Fastlane folder and name it
Paste the following data in there:
Again, APPID is the ID of your project in Firebase.
You should also generate p12 certificate.
GOOGLE_APPLICATION_CREDENTIALS, hit the button as seen in the picture below and generate the key.
Now, add the Firebase App Distribution plugin calling this command:
Before building the project via Fastlane, run this command:
And after a successful build run this one:
he application is being built and will be sent to Firebase App Distribution.
Then, you should accept the invitation in your email and you may start testing your iOS and Android applications.
Opinions expressed by DZone contributors are their own.