Downloads
Learn
Tools
Contact
About
Android's latest App Bundle feature has made supporting multiple devices Supereffient!

Android's latest App Bundle feature has made supporting multiple devices Supereffient!

Gone are the days when we had to scratch our head trying to support all kinds of devices with just one apk. Android App Bundle has made this task Supereasy for us. In this new format for publishing apps, you can deliver a great experience in a smaller app size easily for the huge variety of Android devices available today. It is supereasy easy to switch and you don’t need to refactor your code to start benefiting from a smaller app. Let's first take a look at some specific benefits of using App bundle.

Benefits of using App Bundle

  • Dynamic Delivery

    Dynamic Delivery is a new app serving model of Google Play that uses app bundle to generate and serve highly optimized APKs that accounts for all kinds of device configurations. With dynamic delivery, users have to download only the code and resources they need to run their app. As a result, you app does not contain unnecessary resources that could have affected your app size and user experience. For example, If you have set English as your default language in the app, you don’t need other languages strings to be included in your app.

  • Managing multiple apks became Supereasy

    With app bundle, you no longer have to build, sign, and manage multiple APKs to support different devices. Android App Bundle takes care of all these for you and your users get to download smaller and highly optimized apps. For example, now you don’t have to create multiple APKs for devices with different screen resolutions.

  • Dynamic Feature Module

    Dynamic feature modules allow you to separate certain features and resources from the base module of your app and include them in your app bundle. Through Dynamic Delivery, users can later download and install those components on demand after they’ve already installed the base APK of your app.

  • Reduced APK size

    This directly follows from Dynamic Delivery and Dynamic Feature Module. App bundle has helped in reducing apk size of popular apps like Fandango by 47%, redbus by 30%, Duolongo by 56% and Jaumo by 50% and others. Google Play employs APK splitting mechanism that can break up a big size apk into smaller, discrete packages that are installed on a user’s device on demand.

How app bundle optimizes your apk?

App Bundle provides Dynamic Delivery via APK split mechanism available on Android 5.0 (API level 21) and higher. Split APKs are same as regular APKs — they include compiled DEX bytecode, resources, and an Android manifest. However, the Android platform is able to treat multiple installed split APKs as a single app.

dynamic delivery with app bundle

Three types of apks are involved in Dynamic Delivery: Base APK, Configuration APK and Dynamic Feature APK.

  • Base APK: This contains the foundation of your app's apk. It contains code and resources that all other split APKs can access and provides the basic functionality for your app. When the user downloads the app, they always get this APK.
  • Configuration APK: This APK contains the device configuration like screen density, language or CPU architecture. When a device downloads a base or dynamic feature APK, it downloads only the libraries and resources it needs. In order to enable language, density, and ABI configuration splits, add the following code in android {} block:
      bundle {
         language {
             enableSplit = true
         }
         density {
             enableSplit = true
         }
         abi {
             enableSplit = true
         }
      }
    
  • Dynamic Feature APKs: This is the apk that contains the code and resources that are served on demand to users later by Google Play.

How to build an app bundle in Andoid Studio?

We can easily build app bundle using Android Studio 3.2+ or using command line interface. You can find the generated app bundle at app/build/outputs/bundle/buildVariant/bundle.aab

To add a dynamic feature module to your app project using Android Studio, proceed as follows:

1) In Android Studio 3.2, just go to Build > Build Bundle(s)/APK(s) and select Build Bundle(s).

build app bundle android studio 3.2

2) Via command line interface: ./gradlew bundle

How to deploy your app from an app bundle in Android Studio

1) Select Run -> Edit Configurations from the menu bar.

2) In the left pane of the Run/Debug Configurations dialog, select your desired configuration under the Android App node.

3) In the dropdown menu next to Deploy, select APK from app bundle.

4) Under Dynamic features to deploy, check the box next to each dynamic feature module, if any, you want to include when deploying your app.

5) Click OK.

How to generate a signed app bundle?

Before you uploading your app bundle to the Play console, you need to generate a signed app bundle. To generate a signed app bundle, proceed as follows:

  1. Select Build > Generate Signed Bundle/APK from the menu bar. In the Generate Signed Bundle or APK dialog, select Android App Bundle and click Next.
  2. In the Module dropdown menu, select the base module of the app you want to generate an app bundle for.
  3. Provide information for an existing key and keystore, or create a new one. This is the same type of key and keystore information you provide when building a signed APK.
  4. If you want Android Studio to also save your signing key as an encrypted file, check the box next to Export encrypted key. To be able to upload your app bundle and take advantage of Dynamic Delivery, you need to upload this encrypted file to the Play Console and enroll in app signing by Google Play.
  5. Click Next and provide a Destination Folder for your app bundle. Select the Build Type and flavors that you want to generate app bundles for.
  6. Click Finish.





Author:


Ratul Doley
Ratul Doley
Expertised in ReactJs, NodeJS, Modern Js+Css, Php, Java. Professional Android and iOS app developer and designer. Updated Aoril 02, 2020