How to distribute your application with Firebase App Distribution

Juan Guillermo Gómez Torres
Google Developer Experts
8 min readOct 14, 2021
Firebase Distribution

When you finish developing an application on Android or iOS, you need to send an installer to the test team. How do you distribute it? How do you get the test team to identify the latest or in-production installer? How to communicate the changes or functionalities developed in a new version? How do you know who on the test team downloaded the latest version?

Remember how you did it? know how you would do it? Take a few minutes before answering.

how you did it?

Some practices that you have done and seen in development teams are sending an email with the installer and the description of the changes made; also to send it through a channel in slack, to the drive, or leaving it in a repository in the cloud. But with these practices it is not reliable that it reaches all interested parties in a secure way, nor can it be adequately versioned to do regression tests.

Imagine a platform that allows you to create groups to distribute the installer or pass them a link as an invitation so they can download it? Also, on that platform, you can know who downloaded the installer, that testers can download past versions and always be informed about the latest version? This and more is provided with the Firebase distribution service.

Firebase Distribution is Interesting

Firebase Distribution is a free service that allows us to distribute the installer of our applications to groups of testers with the following properties:

  • It works for iOS and Android.
  • Simple and fast, no need to install SDK.
  • Immediate delivery of the application.
  • It gives us several ways to distribute our installer.
  • Easy management of test equipment.
  • See who accepts the invitation and who downloads it.
  • It is combined with crashlytics to obtain information on the stability of the application.

Now you can distribute APKs and Android App Bundles. Also, IPA for iOS

With Firebase Distribution you can have a light pre-release and feedback process. In addition, it offers us several forms of distribution from manual to automated, that depends on your process. In this article, we are going to detail the different forms of distribution.

Before using any distribution method, you must create groups and add the testers to each one. Let’s see how it is done:

In the Firebase web console you will find Firebase Distribution in the “Release and Monitor” services group, as shown in the following image:

App Distribution Service

Then you create the groups in the tab “Verifiers and groups” and add in each group the emails of those who want to test the application. This is the best practice, however, you cannot create groups and just add the emails.

Created a group and added emails

The above is a way to add the emails, but you could upload the emails through CSV. Now let’s see what strategies exist to distribute. The following examples will be made for Android.

First Strategy to Distribute — Manual

Before uploading the installer you must add the application in a Firebase project, once the group is created you simply upload the signed or debug APK from the Firebase console, in addition to placing a version note and assigning the groups.

Uploaded APK

Once you add the groups, each member receives an email invitation, something similar to the following image.

Email invitation

This email has a link to download an application from Firebase Distribution. This application is a manager that allows you to view the installers and all their versions with their notes.

Apps to test

You can select the one you want to download and you can go to its previous versions.

APK versions

You can see who opened the invitation and downloaded the installer, plus more information from the Firebase web console.

Releases

So you can repeat these steps every time you have a new version that you are going to distribute.

The previous form of distribution is the simplest if you do not have a continuous integration flow, and as you can see, it will take you very little time.

Second Strategy to Distribute — Invitation link

Another very simple way to distribute is by uploading the APK and creating an invitation link, which will take you to a page where you put your email and the invitation will arrive. Then you follow the same process mentioned in the first distribution form.

Created an invite link

This form is relevant if you do not know the emails of those who are going to test the application or you want to invite several people to try and do not want to add their emails one by one.

Invitation page

Third Strategy of distribution: command line.

You can also distribute your installer using the Firebase CLI. Via the command line, you can specify testers, groups, and notes, before you need to create your project in firebase and register your application. In addition to authenticating to the Firebase CLI and running the following command:

Firebase CLI command to distribute

We must write the path of the installer to distribute in the command, the parameters as the Firebase App ID, release notes, tester emails, or groups separated by commas. For more information about the parameters, you can see them here.

The logs that you will see in the console are the following:

Result

Fourth Strategy to distribute — Gradle

Another strategy to distribute is by using Firebase’s distribution Gradle plugin, where you can specify the testers, groups, or notes in your Gradle file, allowing you to configure the distributions for different types of builds and variants of the application. Before doing the following, remember to authenticate to Firebase, either through the Firebase CLI or through a task associated with the Firebase Distribution Plugin or with a service account.

The first thing you should do is add the plugin in Gradle. Then you add in the module’s Gradle file the properties for the distribution, either in the build variant or if you have product flavors.

Add dependencies
Add puglin
Firebase distribution plugin properties

You have the option to put the emails or group names explicitly in the Gradle or in a more configurable way by putting them in a TXT file. So, we want the debug variant then we do the following:

./gradlew assembleDebug appDistributionUploadDebug

And you will have the following result that informs us that the process was successful:

Using APK path in the outputs directory: app/build/outputs/apk/debug/app-debug.apk.
Uploading APK to Firebase App Distribution...
Getting appId from output of google services plugin
Using cached Firebase CLI credentials
This APK has not been uploaded before.
Uploading the APK.
Uploaded APK successfully 202
Added release notes successfully 200
Added testers/groups successfully 200
App Distribution upload finished successfully!

Ready! This is a simple strategy to distribute and some things automated. Now, you can run the proper Gradle task, your APK will be available to testers in minutes.

The fifth and final strategy of distribution: continuous deployment.

If you have a continuous deployment flow or Continuous Deployment (CD), you can check if you have any components to distribute the installer to Firebase. If you use Fastlane, you can find an example of how to do it in the Firebase doc here.

I will show you an example with Bitrise, a platform for Continuous Integration (CI) and deployment for mobile applications. Bitrise allows you to create CI and CD flows in a graphical and simple way, for example, the following image shows a build flow:

Workflow in Bitrise

A flow has a set of steps and there is a Firebase Distribution step, then we can configure it with the Firebase application ID, testers, groups, and release notes. Bitrise will run the workflow, depending on how you have set it, for example when you push a branch or when you make a pull request, or anything else. In this case, when you push the test branch, the installer will be distributed to your testers via Firebase Distribution.

Firebase Distribution properties in Bitrise

Bonus… Continuous Deployment with Github Actions

Github Actions is a new way to more easily create flows for continuous integration and deployment within your GitHub repository. So, you can use firebase distribution with actions. There are several ways to do them. You can add the firebase plugin in the Gradle file as I explained in the fourth strategy. So, create an action workflow with the following content:

Github Action

There are steps that are run before deployment, for example, ktlint or unit tests run; however, the main step to distribute our APK is to build all artifacts and Firebase App Distribution task.

Firebase Distribution is a service that allows you to distribute your applications in a simple and secure way to testers or a group of stakeholders. You can also do the distribution in different ways, depending on the tools you use or according to the process. Get started with Firebase Distribution and your development process will be automated, faster, and more professional.

I hope this information is useful for you. Remember to share this article, your comment is always welcome.

Visit my social networks:

Resources

--

--

Juan Guillermo Gómez Torres
Google Developer Experts

Tech Lead in Wordbox. @GDGCali Founder. @DevHackCali Founder. Firebase & GCPcloud & Kotlin & ODML @GoogleDevExpert . Android lover.