Distribute Android apps to testers using the Firebase CLI

This guide describes how to distribute Android App Bundles (AABs) to testers using the Firebase CLI. The CLI tool lets you specify testers and release notes for a build, then distributes the build accordingly.

App Distribution integrates with Google Play’s internal app sharing service to process the AABs you upload and serve APKs that are optimized for your testers' device configurations. Distributing AABs lets you do the following:

  • Run optimized APKs (served by Google Play) that are optimized to your testers' devices.

  • Uncover and debug device-specific issues.

  • Test app bundle features like Play Feature Delivery and Play Asset Delivery.

  • Reduce the size of downloads for your testers.

Required permissions

To upload AABs to App Distribution, you must link your Firebase app to an app in Google Play. You must have the required level of access to perform these actions.

If you don't have the necessary Firebase access, you can ask a Firebase project Owner to assign you the applicable role via the Firebase console IAM settings. If you have questions about accessing your Firebase project, including finding or assigning an Owner, review the "Permissions and access to Firebase projects" FAQs.

The following table applies to linking a Firebase app to an app in Google Play, as well as uploading AABs.

Action in Firebase console Required IAM permission IAM role(s) that include required permissions by default Additional required role(s)
Link a Firebase app to an app in Google Play firebase.playLinks.update One of the following roles: Access to a Google Play developer account as Admin
Upload AABs to App Distribution firebaseappdistro.releases.update One of the following roles: ––

Before you begin

  1. If you haven't already, add Firebase to your Android project. At the end of this workflow, you'll have a Firebase Android App in your Firebase project.

    If you aren't using any other Firebase products, you only need to create a project and register your app. If you decide to use additional products, be sure to complete all of the steps in Add Firebase to your Android project.

  2. To create a Firebase link to Google Play and to upload AABs, make sure that your app meets the following requirements:

    • The app in Google Play and the Firebase Android app are both registered using the same package name.

    • The app in Google Play is set up on the app dashboard and 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.

  3. Link your Firebase Android App to your Google Play developer account:

    1. In the Firebase console, go to your Project settings, then select the Integrations tab.

    2. On the Google Play card, click Link.
      If you already have links to Google Play, click Manage instead.

    3. Follow the on-screen instructions to enable the App Distribution integration and select which Firebase Android Apps to link to Google Play.

    Learn more about linking to Google Play.

Step 1. Build your app

When you're ready to distribute a pre-release version of your app to testers, build your AAB (visit the Android Studio documentation for instructions).

Step 2. Distribute your app to testers

To distribute your app to testers, upload your app's file using the Firebase CLI:

  1. Install or update to the latest version of the Firebase CLI (we recommend downloading the standalone binary for the CLI specific to your OS). Make sure to sign in and test that you can access your projects.
  2. In the App Distribution page of the Firebase console, select the app you want to distribute, then click Get started.
  3. Run the appdistribution:distribute command to upload your app and distribute it to testers. Use the following parameters to configure the distribution:

    appdistribution:distribute options
    --app

    Required: Your app's Firebase App ID. You can find the App ID in the Firebase console, on the General Settings page.

    --app 1:1234567890:android:0a1b2c3d4e5f67890
    --token

    A refresh token that's printed when you authenticate your CI environment with the Firebase CLI (read Use the CLI with CI systems for more information).

    --token "$FIREBASE_TOKEN"
    --release-notes
    --release-notes-file

    Release notes for this build.

    You can either specify the release notes directly:

    --release-notes "Text of release notes"

    Or, specify the path to a plain text file:

    --release-notes-file "/path/to/release-notes.txt"
    --testers
    --testers-file

    The email addresses of the testers you want to invite.

    You can specify the testers as a comma-separated list of email addresses:

    --testers "ali@example.com, bri@example.com, cal@example.com"

    Or, you can specify the path to a plain text file containing a comma-separated list of email addresses:

    --testers-file "/path/to/testers.txt"
    --groups
    --groups-file

    The tester groups you want to invite (refer to Manage testers). Groups are specified using group aliases, which you can look up in the Firebase console.

    You can specify the groups as a comma-separated list:

    --groups "qa-team, trusted-testers"

    Or, you can specify the path to a plain text file containing a comma-separated list of group names:

    --groups-file "/path/to/groups.txt"
    --debug

    A flag you can include to print verbose log output.

    --test-devices
    --test-devices-file

    The following distribution types are part of the Automated tester beta feature.

    The test devices you want to distribute builds to (refer to Automated tests).

    You can specify the testers as a comma-separated list of email addresses:

    --test-devices: "model=shiba,version=34,locale=en,orientation=portrait;model=b0q,version=33,locale=en,orientation=portrait"

    Or, you can specify the path to a plain text file containing a semicolon-separated list of test devices:

    --test-devices-file: "/path/to/test-devices.txt"
    --test-username

    The username for automatic login to be used during automated tests.

    --test-password
    --test-password-file

    The password for automatic login to be used during automated tests.

    Or, you can specify the path to a plain text file containing a password:

    --test-password-file: "/path/to/test-password.txt"
    --test-username-resource

    Resource name for the username field for automatic login to be used during automated tests.

    --test-password-resource

    Resource name for the password field for automatic login to be used during automated tests.

    --test-non-blocking

    Run automated tests asynchronously. Visit the Firebase console for the automatic test results.

    For example:

    firebase appdistribution:distribute test.aab  \
        --app 1:1234567890:android:0a1b2c3d4e5f67890  \
        --release-notes "Bug fixes and improvements" --testers-file testers.txt
    

    The Firebase CLI outputs the following links after the release upload. These links help you manage binaries and ensure that testers and other developers have the right release:

    • firebase_console_uri - A link to the Firebase console displaying a single release. You can share this link with other developers in your org.
    • testing_uri - A link to the release in the tester experience (Android native app) that lets testers view release notes and install the app onto their device. The tester needs access to the release in order to use the link.
    • binary_download_uri - A signed link that directly downloads and installs the app binary (APK or AAB file) . The link expires after one hour.

    Manage testers and groups

    In addition to distributing releases, you can also use appdistribution:testers:add and appdistribution:testers:remove to invite new testers or remove existing testers from your Firebase project.

    Once a tester has been added to your Firebase project, you can add them to individual releases. Once you remove a tester, they will no longer have access to releases in your project. Note that testers who are recently removed can still retain access to your releases for a window of time.

    For example:

    firebase appdistribution:testers:add anothertester@email.com moretesters@email.com
    
    firebase appdistribution:testers:remove anothertester@email.com moretesters@email.com
    

    Tester emails must be separated by a space. You can also specify testers using --file /path/to/testers.txt.

    If you have a large number of testers you should consider using groups: You can use appdistribution:group:create and appdistribution:group:delete to create or delete groups in your Firebase project.

    Use --group-alias to specify a group for the appdistribution:testers:add and appdistribution:testers:remove commands.

    For example:

    firebase appdistribution:group:create "QA team" qa-team
    
    firebase appdistribution:testers:add --group-alias=qa-team anothertester@email.com moretesters@email.com
    
    firebase appdistribution:testers:remove --group-alias=qa-team anothertester@email.com moretesters@email.com
    
    firebase appdistribution:group:delete qa-team
    

Once you distribute your build, it becomes available in the App Distribution dashboard of the Firebase console for 150 days (five months). When the build is 30 days from expiring, an expiration notice appears in both the console and your tester's list of builds on their test device.

Testers who haven't been invited to test the app receive email invitations to get started, and existing testers receive email notifications that a new build is ready to test (read the tester set up guide for instructions on how to install the test app). You can monitor the status of each tester-whether they accepted the invitation and whether they downloaded the app-in the Firebase console.

Testers have 30 days to accept an invitation to test the app before it expires. When an invitation is 5 days from expiring, an expiration notice appears in the Firebase console next to the tester on a release. An invitation can be renewed by resending it using the drop-down menu on the tester row.

Next steps