Geek Dashboard Home
  • News
  • Smartphones
    • Android
    • iOS
  • Computers
    • Windows
    • macOS
  • Internet
  • Reviews
  • Tools
    • Password Generator
    • iFrame Tester
Search Geek Dashboard
Home • Computer

How to Generate and Extract APK Files from Android App Bundle (AAB)

Amar Ilindra • Updated December 27, 2023 • 7 min read •

In Google, I/O 2018, Android App Bundle, a new file format was introduced to distribute Android apps via Google Play. Later in 2019, Google started recommending developers upload new apps/updates in .aab format instead of the traditional .apk. The main objective of the Android App Bundle is to reduce the size of the app you download from the Play Store. Technically it is a collection of different APKs generated dynamically for various device configurations. If you want to install .aab file outside of the Play Store, you need to first extract APK files from AAB and install them manually on your Android device.

Unlike traditional .apk files, it is not possible to share or sideload the .aab file for testing. When you upload the .aab file in your Google Play Console, an optimized .apk file will be dynamically generated based on the user device configuration.

For example, if an Android app has multiple “strings.xml” files for different languages and your device’s default language is set to English. A .apk file will be generated dynamically for your device excluding all other language files to reduce the .apk size.

Notification History Log Android App Bundle Size Difference

This feature comes in handy from a user point of view, but it added more headaches for developers and testers. Since it is not possible to install a .aab file like APKs, you need to either first upload it to the Play Store for testing or manually generate APK files from Android App Bundle (.aab). Once multiple APKs or universal APK files is extracted from .aab, you can install the app on different device configurations.

Converting Android App Bundle (.aab) to APK File

After generating the Android App Bundle from Android Studio or your favorite IDE, you need to first test how the generated APKs behave when deployed on local mobiles. The quickest way to do this is by converting .aab file to APK and by installing it traditionally.

To extract APK files from Android App Bundle, we’re using bundletool, which is an open-source command-line tool available on GitHub. This tool is for manipulating the Android App Bundle to generate APK set archive (.apks) file. Once the “.apks” file is generated using bundletool, we can extract the APK files by changing the file to .zip format.

Here is how you can use bundletool to generate .apks archive file from Android App Bundle and extract .apk files:

convert aab to apk

Step 1: Download bundletool command-line tool

First, download the latest version of bundletool jar file from GitHub and save it inside a folder on the Desktop. At the time of writing this article, the latest version of bundletool is 1.15.6 and for simplicity, change the file name from bundletool-all-0.15.6.jar to bundletool.jar

bundletool v1.15.6

 

Step 2: Generate APK Set Archive (.apks) file from .aab

Copy your Android App Bundle (.aab) file to the same folder where you have downloaded the bundletool.jar in previous steps. This is very important and you must make sure both bundletool.jar and .aab file is in the same folder every time you run the bundletool command.

As shown in the screenshot, the name of my Android App Bundle is nhl.aab and both “bundletool.jar” and “nhl.aab” files are in the same folder. For this tutorial, we are using the AAB file of our Notification History application.

bundletool.jar and app bundle placed in the same folder

Now open the Command Prompt (Windows) or Terminal (Mac) and change the directory to your Desktop folder using the CD command. To generate an APK set archive (.apks) file containing different APK files of all device configurations your app supports, run the build-apks command as shown below.

java -jar bundletool.jar build-apks --bundle=nhl.aab --output=nhl.apks

  • bundletool.jar – The name of .jar file you downloaded from GitHub
  • nhl.aab – Your Android App Bundle file name
  • nhl.apks – The name of the output file. It is a .apks file. Don’t confuse it with the traditional .apk file.

After running the above command, a new file named “nhl.apks” will be created in the same folder. This is an APK archive file and by extracting it, you will get multiple APK files for different device configurations.

APKs archive file with .apks file extension

Step 3: Extract APK Files

Once the “nhl.apks” file is generated, it is very easy to extract APK files from it. All you have to do is, rename the “nhl.apks” file to “nhl.zip” and extract it normally using ZIP file extractor. You will now find a lot of APK files in splits and standalone folders.

Extracting APKs from AAB

Now you have successfully converted the .aab file to .apk files and you can install them on your device normally. Technically, this is how you can install .aab file on an Android device.

Wait it’s not over yet. Did you notice any problem with the above command? Yes, it is generating plenty of Debug APK files and you are not sure about which one you need to install. What if you want signed APKs or a universal signed APK from Android App Bundle? Fortunately, bundletool comes with different flags for extracting the required APK from .aab file.

Here is a table with different bundletool flags and their usage.

Flag Status Explanation
–ks= Optional Keystore Path
–ks-pass=pass: Optional Keystore password
–ks-key-alias= Optional Key alias
–key-pass=pass: Optional Key alias password
–mode=universal Optional To generate a single Universal APK file
–overwrite Optional Overwrites the output .apks file if the same file name exists

Let’s take a look at how to use these flags along with bundletool command.

Generating Signed APKs using your Keystore

To generate signed APK files with your keystore file, run the below command.

java -jar bundletool.jar build-apks --bundle=nhl.aab --output=nhl.apks --ks=keystore.jks --ks-pass=pass:your_keystore_password --ks-key-alias=your_key_alias --key-pass=pass:your_key_password

This will again generate an “nhl.apks” file and you need to rename it to “nhl.zip” and extract the zip file to see signed apks in both splits and standalone folders.

Generating a Universal APK from Android App Bundle

If you want to generate only one single APK from your .aab file, run the below command.

java -jar bundletool.jar build-apks --bundle=nhl.aab --output=nhl.apks --mode=universal

This command will generate nhl.apks file and again you need to rename it to nhl.zip and extract it to get universnal.apk file.

Overwriting existing .apks file

If you want to overwrite the old .apks file with the new one, you need to just add the –overwrite flag to your command as shown below.

java -jar bundletool.jar build-apks --bundle=nhl.aab --output=nhl.apks --overwrite

Extracting Signed Universal APK file from Android App Bundle

Now let’s combine all the above flags to generate a single universal APK file and also overwrite the existing APK archive if already available.

java -jar bundletool.jar build-apks --bundle=nhl.aab --output=nhl.apks --overwrite --mode=universal --ks=keystore.jks --ks-pass=pass:your_keystore_password --ks-key-alias=your_key_alias --key-pass=pass:your_key_password

After running this command, you will need to rename the generated “nhl.apks” file to “nhl.zip” and extract it to find the signed “universal.apk” file.

extracting universal APK from App Bundle

There are a few more advanced flags like --device-spec, --connected-device, --device-id to generate an APK and install the Android App Bundle on connected or specific device configurations. Apart from them you also have extract-apks and get-size total commands for more use cases. You can find more about them on the Android Developer Bundletool page here.

Also Read: How to Fix DF-DFERH-01 – Error retrieving information from server in Google Play

Conclusion for extracting APK files from AAB

To conclude, the one possible way to install the Android App Bundle (.AAB) is by uploading it directly to the Google Play Store for a set of testers or using the bundletool command to convert .aab to .apk file. If your app is big and has a lot of active users, use the bundletool to test the app on different device configurations and roll out the updates slowly. However, if your app is new, you can prefer adding the App Bundle in closed alpha to gather the feedback.

In the long run, it is always better to extract APKs from the App Bundle first. And test them manually on local devices before submitting the update from your Google Play Console.

Computer Android APK App Bundle Development Play Store

Be the Change!

Spread the word and help us create better tech content

Facebook Twitter Reddit WhatsApp Pinterest
Avatar for Amar Ilindra

Amar Ilindra

•
Facebook LinkedIn Instagram GitHub

Amar Ilindra is a tech-savvy individual who is passionate about gadgets and new technology. He is a full-stack developer who enjoys experimenting with technology and sharing his experiences through blogging. When he's not writing, he devotes his time to creating practical web and mobile applications for both Android and iOS platforms.

Read all 480 articles from Amar

Comments

  1. Avatar for SyamSyam says

    October 18, 2022 at 2:38 PM

    After renaming the .apks to .zip, I am unable to open the file as it says that “You do not have permission to open the document”. How to open the file now?

  2. Avatar for SyamSyam says

    October 18, 2022 at 10:11 AM

    Thank you for the detailed article. This article explains about how to generate signed .apk form .aab. But we need to upload signed .aab to playstore. Can you please let me know how to generate signed .aab?

    • Avatar for Amar IlindraAmar Ilindra says

      October 18, 2022 at 6:15 PM

      You can generate the signed AAB from Android Studio. Go to Build – Generate Signed Bundle / APK… and choose Android App Bundle. Click Next.

      Now select your Key store file and type Key store password, Key alias, and Key password. Now select Release and hit Finish.

  3. Avatar for Akshay KhandizodAkshay Khandizod says

    March 17, 2022 at 4:23 PM

    AAB to APK Converter

    I have developed a windows tool for converting .aab files to .apk in Python.

    It supports creating both debug and signed APK which can be directly installed to default android devices connected through USB.
    It uses Google’s Bundle Tool in the backend.

    Source Code: https://github.com/idzresearch/aab-to-apk-converter

    This is the first tool that I have developed, Hope it is useful. I am open to suggestions and bug reports.

    • Avatar for Amar IlindraAmar Ilindra says

      March 17, 2022 at 8:17 PM

      Great tool Akshay. It was a good start.

      Consider improving the UI. Check Dribbble for inspiration.

    • Avatar for George BirbilisGeorge Birbilis says

      May 15, 2022 at 3:34 AM

      Hi Akshay, does your tool generate universal APK?

  4. Avatar for JeswinJeswin says

    July 1, 2021 at 7:58 PM

    Rename the .aab file to .xapk and Install it using apkpure app…..
    If it is not working, install the app directly from apkpure.
    Download the app from apkpure.com

    Any way it is not recommended to install apps from third party sources

  5. Avatar for majhi kalajimajhi kalaji says

    June 24, 2021 at 4:09 PM

    helps me a lot… thanks

  6. Avatar for humptyhumpty says

    May 30, 2021 at 1:26 AM

    Kudos, This is saved me a lot of time!

    btw,
    (typo -ks=keystore.jks –ks=keystore.jks)

    • Avatar for Amar IlindraAmar Ilindra says

      May 30, 2021 at 8:09 PM

      Glad you find the article helpful.

      I couldn’t understand the typo you suggested. Can you please help me in finding the typo?

      • Avatar for George BirbilisGeorge Birbilis says

        May 15, 2022 at 3:23 AM

        the typo is in the last combined command, it says “-ks” instead of “--ks“

        • Avatar for Amar IlindraAmar Ilindra says

          May 17, 2022 at 11:06 AM

          Thanks, George Bribilis,

          I fixed the typo.

  7. Avatar for santosh Kudalkarsantosh Kudalkar says

    December 3, 2020 at 4:59 PM

    Very Nice Article, you explained very well. Only one thing I didn’t understand how you generated keystore.jks file in the folder. Can you please explain that.

    • Avatar for Amar IlindraAmar Ilindra says

      December 4, 2020 at 12:15 PM

      keystore.jks not generated. It is your original Keystore file. You need to either paste it manually into your folder OR provide the full file path.

      • Avatar for nathnath says

        February 23, 2021 at 6:59 PM

        Hi Amar How to generate a keystorefile

        • Avatar for Amar IlindraAmar Ilindra says

          May 30, 2021 at 8:07 PM

          You can generate the Keystore file from Android Studio. Select Build and then choose Generate Signed APK option. You will get a dialog to choose the existing Keystore along with a button to create a new Keystore file.

          You just need to provide the basic details like organization name, address, alias, password, etc.

          Note: Please make sure you remember the password or store it somewhere else. Resetting it later is a headache or may be impossible too.

Over 1,30,286+ Followers

Join now to get all latest updates from Geek Dashboard

Facebook Twitter Telegram Pinterest YouTube Instagram

Recently Published

  1. TAGRY X08 True Wireless Earbuds Review: Budget-Friendly Excellence with Long Battery Life
  2. Why Are Tech Lawsuits Becoming the New Normal in the US
  3. My Experience of Using TuneFab Amazon Video Downloader
  4. Wondershare Dr. Fone 13 Review - The Ultimate Mobile Toolkit for iOS and Android
  5. TOZO OpenEgo Review - Is It a Reliable and Practical Headphone?
  6. Samsung Lost its Crown as the Top Foldable Smartphone Seller Worldwide

Download the Apps Now

We put a lot of effort and resources in writing our articles, and we believe it is our responsibility to satisfy your tech hunger

Download Geek Dashboard Android App on Google PlayAndroid App onGoogle Play Download Geek Dashboard Extension on Chrome Web StoreBrowser Extension onChrome Web Store
Geek Dashboard Logo

Geek Dashboard brings you the latest and greatest in technology news, reviews, and how-to guides. From smartphones to laptops, drones to VR and everything in between, we've got you covered

Got a Tip? Write In? tip@geekdashboard.com

© 2012 - 2025 · Geek Dashboard, product of ikva eSolutions

  • Blog
  • Advertise
  • About
  • Jobs
  • Contact
  • Privacy Policy
  • Write For Us
  • T&C
  • Office Setup

No dogs were injured while working on this website because we love them