DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • A Beginner's Guide to Docker Compose
  • My First Practical Agentic App: Using Firebase and Generative AI to Automate Office Tasks
  • Building a Voice-Powered Smart Kitchen App Using LLaMA 3.1, Firebase, and Node.js
  • Emulating the History Command Within a Bash Script

Trending

  • How SaaS Architectures Break at Scale — and the Engineering Decisions That Prevent It
  • DevOps and Platform Engineering Readiness Checklist: Everything Needed for a Scalable, Secure, High-Velocity Delivery Platform
  • Using LLMs to Automate Data Cleaning and Transformation Pipelines
  • AWS Kiro: The Agentic IDE That Makes Specs the Unit of Work
  1. DZone
  2. Coding
  3. Frameworks
  4. How to Distribute Your Flutter Project Using Firebase App Distribution

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.

By 
Evgeniy Altynpara user avatar
Evgeniy Altynpara
·
Dec. 27, 20 · Tutorial
Likes (5)
Comment
Save
Tweet
Share
12.3K Views

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:

Shell
 




x


 
1
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"


And then:

Shell
 




xxxxxxxxxx
1


 
1
brew install ruby 


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 PATH, run:

Shell
 




xxxxxxxxxx
1


 
1
echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.zshrc


Or you can open your .zshrc file and add the following lines:

Shell
 




xxxxxxxxxx
1


 
1
export PATH="/usr/local/opt/ruby/bin:$PATH"
2
export LDFLAGS="-L/usr/local/opt/ruby/lib"
3
export CPPFLAGS="-I/usr/local/opt/ruby/include"


Here is how my file looks like after that:

2. Installing Fastlane

Type the following command to install Fastlane:

Shell
 




xxxxxxxxxx
1


 
1
xcode-select --install


And then:

Shell
 




xxxxxxxxxx
1


 
1
brew cask install fastlane


Open the specified file and add there:

Shell
 




xxxxxxxxxx
1


 
1
export PATH="$HOME/.fastlane/bin:$PATH"


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:

Shell
 




xxxxxxxxxx
1


 
1
cd android


Then:

Shell
 




xxxxxxxxxx
1


 
1
fastlane init


As you see, you should type the name of a package. You can find it in the following file:

XML
 




xxxxxxxxxx
1


 
1
AndroidManifest.xml package=
2
project_name/android/app/src/main/AndroidManifest.xml


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. 

Shell
 




xxxxxxxxxx
1


 
1
curl -sL firebase.tools | bash
2
firebase login
3
firebase list


If you see the list of your projects after executing the final command, it means that everything works just fine. 

Shell
 




xxxxxxxxxx
1


 
1
fastlane add_plugin firebase_app_distribution


Change your Fastfile file to:

Dart
 




xxxxxxxxxx
1
21


 
1
platform :android do
2
   desc "New Build to App Distribution Beta"
3
   lane :beta_app_distribution do
4
        gradle(task: "clean assembleRelease")
5
       firebase_app_distribution(
6
           app: ENV["APPID"],
7
           firebase_cli_path: "/usr/local/bin/firebase",
8
           apk_path: "../build/app/outputs/apk/release/app-release.apk"
9
       )
10
   end
11
end


Then, create a file in the Fastlane folder and name it .env.default. 

Plain Text
 




xxxxxxxxxx
1


 
1
PROJECT_NAME=Name your project
2
CONFIGURATION=Release
3
APPID=1:17448389999:android:902a57811128931a5d78a1


Where APPID is the ID of your project in Firebase. 

And run the command: 

Plain Text
 




xxxxxxxxxx
1


 
1
fastlane beta_app_distribution 


If you don’t have Java 8 installed, you can download it from Oracle website. 

Or use the following commands: 

Shell
 




xxxxxxxxxx
1
11
9


 
1
# add open jdk repo
2
brew tap adoptopenjdk/openjdk
3
# see available versions
4
brew search openjdk
5
# install specific version
6
brew cask install adoptopenjdk8


Set JAVA_HOME.

Shell
 




xxxxxxxxxx
1


 
1
export JAVA_HOME=/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home
2
export PATH=$JAVA_HOME/bin:$PATH


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:

Shell
 




xxxxxxxxxx
1


 
1
cd ios
2
fastlane init


Then, enter your Apple ID and two-factor authorization code, if any.

Create a file in the Fastlane folder and name it .env.default. 

Paste the following data in there:

JSON
 




xxxxxxxxxx
1


 
1
PROJECT_NAME=App Name
2
SCHEME=Runner
3
CONFIGURATION=Release
4
CRASHLYTICS_GROUPS=qa_team
5
CERTIFICATE_PATH=./fastlane/credentials/Certificates.p12
6
INFO_PLIST_PATH=Runner/Info.plist
7
ENVIRONMENT=DEVELOPMENT
8
APPID=1:188999999994:ios:f1cdb1234fdd1d56484ee1 
9
GOOGLE_APPLICATION_CREDENTIALS=./fastlane/credentials/private-key.json


Again, APPID is the ID of your project in Firebase.

You should also generate p12 certificate. 

To get GOOGLE_APPLICATION_CREDENTIALS, hit the button as seen in the picture below and generate the key.

Appfile:

Dart
 




xxxxxxxxxx
1


 
1
app_identifier "com.example.ios" # The bundle identifier of your app
2
apple_id "[email protected]" # Your Apple email address
3
itc_team_id "123456789"
4
team_id "99D0P2SS1M"
5
# For more information about the Appfile, see:
6
#     https://docs.fastlane.tools/advanced/#appfile


Fastfile:

Dart
 




xxxxxxxxxx
1
33


 
1
default_platform(:ios)
2
platform :ios do
3
   desc "New Build to App Distribution Beta"
4
   lane :beta_app_distribution do
5
      build_ios_app(
6
             clean: true,
7
             workspace: 'Runner.xcworkspace',
8
             scheme: 'Runner',
9
             export_method: 'ad-hoc'
10
       )
11
       firebase_app_distribution(
12
           app: ENV["APPID"],
13
           testers: "[email protected]",
14
           firebase_cli_path: "/usr/local/bin/firebase",
15
       )
16
   end
17
end


Now, add the Firebase App Distribution plugin calling this command: 

Shell
 




xxxxxxxxxx
1


 
1
fastlane add_plugin firebase_app_distribution


Before building the project via Fastlane, run this command:

Shell
 




xxxxxxxxxx
1


 
1
flutter build ios 


And after a successful build run this one: 

Shell
 




xxxxxxxxxx
1


 
1
bundle exec fastlane beta_app_distribution 


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.

Firebase app Flutter (software) Distribution (differential geometry) shell Command (computing)

Opinions expressed by DZone contributors are their own.

Related

  • A Beginner's Guide to Docker Compose
  • My First Practical Agentic App: Using Firebase and Generative AI to Automate Office Tasks
  • Building a Voice-Powered Smart Kitchen App Using LLaMA 3.1, Firebase, and Node.js
  • Emulating the History Command Within a Bash Script

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook