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.

To follow this guide, you'll need to have access to a Google Play account for which you're an Admin or Owner, and an app that's been published on the Play account.

About distributing Android App Bundles

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. When you distribute AABs, you can:

  • 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.

Before you begin

  1. If you haven't already, add Firebase to your Android project.

    If you aren't using any other Firebase products, you only have to create a project and register your app. However, if you decide to use additional products in the future, be sure to complete all of the steps on the page linked above.

  2. Connect your Firebase project to your Google Play account. Once connected, apps that meet the following requirements are automatically linked between your Firebase project and your Google Play account:

    • The app you upload to Google Play and Firebase must share the same package name.

    • The app in Google Play must be in a published state. An app is published when its app store listing has been completed and approved, and the app has been distributed to a following Google Play track: internal, closed, production, or open-testing.

    To connect your Firebase project:

    1. Make sure you are the Owner of your Firebase project and the account Admin or Owner of your Google Play account.

    2. In your Firebase project, navigate to (Settings), then click Project settings > Integrations.

    3. If you haven't already, enable Google Analytics via the Google Analytics card. This is required for linking your project to Google Play.

    4. Click Link on the Google Play card.

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 AAB 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.

    For example:

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

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.