Generating and deploying Android app bundles

Creating an Android App Bundle with Bitrise is almost the same as generating an APK. All you have to do is tweaking a few Step inputs to compile an Android App Bundle (.aab) file from your code, then get the bundle signed and deployed to Google Play Store.

Step versions supporting bundle creation

The following Steps must be of the indicated version or newer - older versions of the Steps do NOT support bundle creation.

  • Android Build 0.10.0 or newer

  • Gradle Runner 1.9.0 or newer

  • Android Sign 1.3.0 or newer

  • Deploy to Google Play 1.6.0 or newer

Generating an Android App Bundle file

You can create an Android App Bundle with either the Gradle Runner Step or with the Android Build Step.

Using the Gradle Runner Step

  1. Open your app on Bitrise.

  2. Go to the Workflow tab.

  3. Select a Workflow from the WORKFLOW dropdown menu.

    Installing any additional tools
  4. Insert the Gradle Runner Step after the Android Unit Test and Android Lint Steps in your Workflow (if the build Step is not already there).

  5. Click the Config section of Gradle Runner.

  6. In the Gradle task to run input field, set, for example, bundleRelease or bundleDebug to create a bundle of your project.

    Generating and deploying Android app bundles

This way the Step will generate an Android App Bundle instead of an APK.

If you wish to generate an Android App Bundle and an APK in one workflow, you can specify an additional task in the Gradle task to run input field:

Generating and deploying Android app bundles

Using the Android Build Step

You can generate an Android App Bundle for your Android app with our Android Build Step as well:

  1. Open your app on Bitrise.

  2. Go to the Workflow tab.

  3. Select a Workflow from the WORKFLOW dropdown menu.

    Installing any additional tools
  4. Add the Android Build Step after the Android Unit Test and Android Lint Steps in your Workflow (if the build Step is not already there).

  5. Provide the root directory of your Android project in the Project Location input field.

  6. Go to Build type and select aab as build type.

    Generating and deploying Android app bundles

If you wish to generate an APK and an Android App Bundle in one workflow, add two Android Build Steps after each other and configure one to build an Android App Bundle and the other to build an APK.

 

 

  •  

  •  

 

  1.  

  2.  

    Generating and deploying Android app bundles

 

Deploying your Android App Bundle to Google Play

Deploying an AAB file isn't significantly different from deploying an APK to Google Play.

If you want to check the bundle prior to app store distribution, you can add the Deploy to Bitrise.io Step after the Gradle Runner / Android Build Steps. It uploads the bundle into the APPS & ARTIFACTS tab of your Build’s page.

Setting up Google Play deployment for the first time

Deploying to Google play publishes your app to Google's online store. When you do it for the first time, this requires a bit more work than simply deploying to bitrise.io. Once the necessary configurations are in place, it becomes very simple.

When configuring Google Play deployment for the first time, you need to link your Google Play Developer account to an API project, set up API access, and upload the service account JSON key to Bitrise.

  1. Upload the first AAB or APK manually to Google Play using the Google Play Console.

  2. Link your Google Play Developer Console to an API project.

  3. Set up API Access Clients using a service account: Please note when you create your service account on the Google Developer Console, you have to choose json as Key Type.

  4. Grant the necessary rights to the service account with your Google Play Console. Go to Settings, then Users & permissions, then Invite new user. Due to the way the Google Play Publisher API works, you have to grant at least the following permissions to the service account:

    • Access level: View app information.

    • Release management: Manage production releases, manage testing track releases.

    • Store presence: Edit store listing, pricing & distribution.

  5. As an optional step, you can add translations to your Store Listing: Translate & localize your app.

  6. Open your app on Bitrise.

  7. Go to the Workflow tab.

  8. Go to the Code Signing tab and upload the service account JSON key into the GENERIC FILE STORAGE.

Deploying to Google Play

Deploying to Google Play requires a signed APK or AAB file and the Google Play Deploy Step.

  1. If you're trying to deploy your app for the first time, make sure your Google Play configuration is set up correctly.

  2. Open your app on Bitrise.

  3. Go to the Workflow tab.

  4. Go to the Code Signing tab and copy the Environment Variable key which stores your uploaded the service account JSON key file’s URL.

  5. Copy the Environment Variable key which stores your uploaded file’s URL.

    For example: BITRISEIO_SERVICE_ACCOUNT_JSON_KEY_URL.

  6. Open your Workflow and add the Google Play Deploy Step to it.

  7. In the Service Account JSON key file path input, paste the Environment Variable which was generated when you uploaded the service account JSON key in the GENERIC FILE STORAGE. Besides the generated Env Var, you can also add a file path right in the Step’s input field where the file path can be local or remote too:

    • For remote JSON key file you can provide any download location as value, for example, https://URL/TO/key.json.

    • For local JSON key file you can provide a file path url as value, for example, file://PATH/TO/key.json.

  8. In the Package name input, add the package name of your app.

  9. In the Track input, add the track where you want to deploy your APK (for example, alpha/beta/rollout/production or any custom track you set).

That’s all! Start or schedule a build and share the URL with external testers or distribute your app on an app store of your choice!