what is an apk file, aab file android apk, differences between apk and aab

Differences between apk and aab files in android

Unlike web development technologies where you check the result of the code that you have compiled after saving, in android development the result is not visible after you click save.

For you to view the result of the code you have compiled in android applications, you have to build a file that is compatible with mobile devices or any other device that is approved to run an android app.

In android development, an executable file either being an apk file or an aab file is installed in a mobile device which comprises the executables for the android app

In this article, we shall discuss what is an apk file, what is an aab file, what are the differences between apk and an aab file, how to generate an apk and aab file in android studio

What is an apk file in android?

An APK in full means Android PacKage which is a format used by the Android operating system to install applications to devices operating on the Android operating system.

The file must have an extension .apk or must be of type apk for it to be considered an executable by the android operating system

An APK file can both be generated when using either java or kotlin languages while developing android applications

Generally, an apk file is a file that is created for android devices

What is an aab file in android?

AAB in android is an Android App Bundle which is a file supported in android that has the entire codes for a particular application compiled

The aab file is uploaded to google play store whereby it is then used to generate android package (apk) files which are optimized to fit in a particular device that the user is using to fit

An aab has been recently been introduced by android so that it can give users a specific optimized version of the executable that fits in their device well

An aab file format allows users to get smaller download file sizes due to the fact that google optimizes and creates an apk with features that are only compatible with their devices.

What are the differences between an apk file and an aab file in android?

Both apk files and aab file formats can be uploaded to the google play store but the difference is that the current recommended format is aab since it allows google to optimize and generate an apk that is compatible with a given device

An apk file can be installed directly to a mobile device while an aab file format cannot since it is a publishing format.

An aab file format is a publishing format to google play store while apk file format is a packaging format that is installed in a device

Once published, the size of an apk cannot change but if an aab is used, the size of the apk can change since google will only use the necessary files to compile an apk specific to that device

How to generate an apk or an aab file in android studio?

Once you have finished development of an app or you have added a new feature and you want to test whether it’s working, you can generate an apk file that can be installed on your android device to view it working

If you want to publish the app in the google play store, you will need to generate an aab bundle which must be signed

To generate an apk or an aab in android studio,

  • Once in the selected android app project, click build
  • A dropdown will appear, scroll down to Build bundle / APKS and click it

Differences between apk and aab files in android

  • Two options will appear, one for build apk and another one for build bundle
  • If you want an apk, click build apk, and Gradle build will start running, wait for it to finish

Once it has finished, it will alert you that apk has been generated and it will give you the options to locate it in your files as shown below

Differences between apk and aab files in android

  • To generate an aab file, click on build bundle and Gradle will start building

Once the execution is complete, it will alert you that it has been completed successfully

  • Locate the files on your computer and for apk you can install in your mobile device directly



In the above discussion, we have defined what is an apk and what is an aab, we have shown what are the differences between apk and aab, and also discussed how you can generate each file using android studio.

Hope you can now differentiate between the two and known which one to prefer while uploading in google play store

That’s all for this article. Follow us for more