# Exporting a universal APK from an AAB

You can test an Android app on a test device even if the generated artifact is an App Bundle (`.aab`). With the [**Export Universal APK**](https://github.com/bitrise-steplib/bitrise-step-export-universal-apk) Step you can export a universal APK from the App Bundle, sign it with a keystore (or debug keystore), and deploy the APK to your test device before releasing the app to the Google Play Store.

To configure this Step:

  

**Workflow Editor**

  1. Insert the [**Export Universal APK**](https://github.com/bitrise-steplib/bitrise-step-export-universal-apk) Step after the [**Android Build**](https://github.com/bitrise-steplib/bitrise-step-android-build) Step in your Workflow.
  1. Make sure the **Android App Bundle path** input's value is the output variable (BITRISE_AAB_PATH) of the previous build Step.

     :::note[Using a different build Step]

     If you don't use the [**Android Build**](https://github.com/bitrise-steplib/bitrise-step-android-build) Step to build an AAB file, make sure that the input points to the AAB output of the Step you used. You can use an [Environment Variable](/bitrise-ci/configure-builds/environment-variables), or a direct local path or URL.

     :::
  1. Make sure the **Keystore URL** input points to your Android keystore file.

     We recommend uploading the file to Bitrise and using the default Env Var: $BITRISEIO_ANDROID_KEYSTORE_URL. You can, however, use a local path or a URL as input value here.
  1. Provide your credentials in the **Key alias** and the **Keystore password** inputs.

     If you uploaded a keystore file to Bitrise, the default value of the inputs should not need to be changed.
  1. In the **Bundletool version** input, you can override the default Bundletool version if you need a specific one but make sure you use the [correct version](https://github.com/google/bundletool/releases).
  1. Run your Workflow.

  
  

**Configuration YAML**

  1. In your app's Configuration YAML file, insert the `bitrise-step-export-universal-apk` Step after the `android-build` Step.

     ```yaml
     my-workflow:
       steps:
         - android-build: {}
         - bitrise-step-export-universal-apk:
             inputs:
     ```
  1. Make sure the `aab_path` input's value is the output variable ($BITRISE_AAB_PATH) of the previous build Step.

     :::note[Using a different build Step]

     If you don't use the `android-build` Step to build an AAB file, make sure that the input points to the AAB output of the Step you used. You can use an Environment Variable, or a direct local path or URL.

     :::

     ```yaml
     my-workflow:
       steps:
         - android-build: {}
         - bitrise-step-export-universal-apk:
             inputs:
             - aab_path: "$BITRISE_AAB_PATH"
     ```
  1. Make sure the `keystore_url` input points to your Android keystore file.

     We recommend uploading the file to Bitrise and using the default Env Var: $BITRISEIO_ANDROID_KEYSTORE_URL. You can, however, use a local path or a URL as input value here.

     ```yaml
     my-workflow:
       steps:
         - android-build: {}
         - bitrise-step-export-universal-apk:
             inputs:
             - aab_path: "$BITRISE_AAB_PATH"
             - keystore_url: "$BITRISEIO_ANDROID_KEYSTORE_URL"
     ```
  1. Provide your credentials in the `keystore_alias` and the `keystore_password` inputs.

     If you uploaded a keystore file to Bitrise, the default value of the inputs should not need to be changed. Otherwise store your credentials in a [Secret](/bitrise-ci/configure-builds/secrets) and use the Secrets as the input values.

     ```yaml
     my-workflow:
       steps:
         - android-build: {}
         - bitrise-step-export-universal-apk:
             inputs:
             - aab_path: "$BITRISE_AAB_PATH"
             - keystore_url: "$BITRISEIO_ANDROID_KEYSTORE_URL"
             - keystore_password: "$BITRISEIO_ANDROID_KEYSTORE_PASSWORD"
             - keystore_alias: "$BITRISEIO_ANDROID_KEYSTORE_ALIAS"
     ```
  1. In the `bundletool_version` input, you can override the default Bundletool version if you need a specific one but make sure you use the [correct version](https://github.com/google/bundletool/releases).

     ```yaml
     my-workflow:
       steps:
         - android-build: {}
         - bitrise-step-export-universal-apk:
             inputs:
             - aab_path: "$BITRISE_AAB_PATH"
             - keystore_url: "$BITRISEIO_ANDROID_KEYSTORE_URL"
             - keystore_password: "$BITRISEIO_ANDROID_KEYSTORE_PASSWORD"
             - keystore_alias: "$BITRISEIO_ANDROID_KEYSTORE_ALIAS"
             - bundletool_version: 1.8.1
     ```
  1. Run your Workflow.

  

The [**Export Universal APK**](https://github.com/bitrise-steplib/bitrise-step-export-universal-apk) Step exports the APK to the `$BITRISE_APK_PATH` Environment Variable which the next Steps can pick up. If the [**Deploy to Bitrise.io - Build Artifacts, Test Reports, and Pipeline intermediate files**](https://github.com/bitrise-steplib/steps-deploy-to-bitrise-io) Step is included in your Workflow, [Release Management](/release-management) can deploy the APK for you.
