Distribute app bundle releases to testers - Codelab

1. Overview


In this codelab, you'll learn how to distribute Android App Bundle releases to testers using Firebase App Distribution and its Gradle plugin. App Distribution provides a central hub for you to manage pre-release versions of your app and the testers you invite to each release.

What you'll learn

  • How to link your Firebase app to Google Play
  • How to package and build your app as an app bundle
  • How to create a release and share it with live testers
  • How to download and test new releases as a tester

What you'll need

  • Latest Android Studio version
  • A signed bundle file that you generated from Android Studio
  • A Google Play developer account for which you're the Owner or Admin
  • Your app in Google Play is set up on the Google Play app dashboard, and it has the following status:
    • The app is distributed to one of the Google Play tracks (Internal testing, Closed testing, Open testing, or Production).
    • The app's review in Google Play is complete and the app is published. Your app is published if the App status column displays one of the following statuses: Internal testing (not Draft internal testing), Closed testing, Open testing, or Production.
  • An email address you can use as a tester to receive new build invitations from Firebase

2. Create a Firebase project

  1. Sign in to Firebase.
  2. In the Firebase console, click Add Project, then name your project "AppBundlesCodelab." Remember the Project ID for your Firebase project. If you don't edit the Project ID, Firebase automatically assigns a unique ID for your project.

  3. (Optional) When prompted, enable Google Analytics.
  4. Complete the remaining steps, then click Create project.

Add your app bundle to the project

  1. In the Firebase console, click Add app.

  2. When registering your app, make sure to use the same package name as the app that's uploaded to your Google Play developer account. Finally, click Register app.
  3. Complete the remaining steps to add your app's Firebase configuration file (google-services.json) to your app. Note that for Android, App Distribution doesn't have a Firebase SDK to add to your app.
  4. Click Continue to console.
  1. In the Firebase console, go to your Project settings.

  2. In the Integrations tab, click Link on the Google Play card.
  3. Follow the on-screen instructions to enable the App Distribution integration, then select your newly created Firebase app to link to Google Play.

Now that you've completed these steps, your Firebase app will be linked to your app in your Google Play developer account as long as the apps' package names match.

3. Add App Distribution to your project

Add the App Distribution Gradle plugin

Now, you'll use Android Studio to add App Distribution and its Gradle plugin to your app.

  1. In your project-level Gradle file (android/build.gradle.kts), add the App Distribution Gradle plugin to the plugins block.
    plugins {
         // Add the App Distribution Gradle plugin
         id("com.google.firebase.appdistribution") version "4.0.0" apply false
  2. In your project-level Settings Gradle file (android/settings.gradle.kts), add Google's Maven repository to the pluginManagement block.
     pluginManagement {
         // Check that you have Google's Maven repository (if not, add it).
         repositories {
  3. In your app-level Gradle file (android/app/build.gradle.kts), add the App Distribution plugin to the plugins block.
    plugins {
         // Add the App Distribution plugin
  4. If you're behind a corporate proxy or Firewall, add the following Java system property that enables App Distribution to upload your distributions to Firebase:
    -Djavax.net.ssl.trustStore=/path/to/truststore -Djavax.net.ssl.trustStorePassword=password

Authenticate your Firebase project

Before you can use the Gradle plugin, you'll need to authenticate your Firebase project. For this codelab, you'll sign in to your Google account using the Firebase CLI.

Run the following command at the root of your Android project:

~/your-android-project$ firebase login

The reference documentation contains more details.

4. Configure your bundle properties in Android Studio

In this step, you'll add yourself as a tester for the build you'll distribute later. Once you distribute the build, testers get email notifications from Firebase inviting them to test the new build.

In your app/build.gradle.kts, add a firebaseAppDistribution section and include the following parameters:

  • appID: Your app's Firebase App ID. You can find it in the General tab of your Project settings.
  • artifactType: Your app's file type (AAB).
  • testers: Your testers' email addresses. For this codelab, add your own email so you can test your build once it's distributed.

For example:

    android {

       // ...

       buildTypes {
            getByName("release") {
                firebaseAppDistribution {
                  appId = "yourAppId"
                  artifactType = "AAB"
                  testers = "ali@example.com, bri@example.com, cal@example.com"

        // ...

As an option, you can also override the values set in your build.gradle.kts by passing command line arguments in the form of -PappDistribution-property-name=property-value.

5. Build and distribute a release

  1. Run the bundleVariant Gradle task to build your app bundles file:
    $ ./gradlew :base:bundleRelease
  2. Locate the bundle in your application's build directory (the default location is app/build/outputs/bundle/release).
  3. To distribute the release, build the targets bundleRelease and appDistributionUploadRelease with your project's Gradle wrapper. Include the Firebase token (the one you received in step 3: Add App Distribution to your app).
    export FIREBASE_TOKEN=your_firebase_token
    ./gradlew --stop // Only needed for environment variable changes
    ./gradlew bundleRelease appDistributionUploadRelease

Testers will now receive email invitations to download and test the build. As the developer, you can now monitor the build in the Releases tab of the App Distribution dashboard.

6. Download and test your release

In this section, you'll get set up as a tester in order to download the release you distributed. As a tester, you'll need to authenticate your test device and enable internal app sharing in the Google Play Store app.

  1. On your test device, sign in to your tester email account and open the invitation from Firebase.

  2. Sign in with your Google account and accept the invitation to test the distributed release. As an option, you can also download Firebase App Tester, which prevents downloaded releases from being added to your device's Downloads folder. It also displays additional information about releases, such as the download progress and release version.

  3. Tap Download on the release to install it from the Play Store.
  4. When prompted, complete the remaining steps to enable internal app sharing (the instructions are displayed on your test device and only need to be completed once).

Once the download is complete, your release will automatically appear as a shortcut in your device's home screen.

7. Congratulations!

You just used Firebase App Distribution to upload an app bundle and distribute a release to testers.

Next steps