Android has over 2 billion monthly active devices and these devices differ on the basis of different CPU architecture and different screen sizes and densities among other features. Developers when releasing an app need to cater to all users and creating a single APK, which is compatible to all devices, can make it extremely heave in size, as it contains resources for every device in it. This is an inefficient practice as why would a user download a heavy APK file to use a small app and bear the resources for all other device models as well.
Creating multiple APKs not only reduces the size of the app but can also help developers expand their user base by catering to multiple users across different device structures. Multiple APKs help you provide the same app to all the users with different files without using any resources. You can learn more about APK Split and how multiple APKs help developers in this article.
Splitting an App into Multiple APKs
Android app package or APK is the file format used by Android OS for distributing and installing the apps. An APK is generated once an Android File is compiled and all of its parts are packaged into a single file. This file has a .apk extension and can be used to install or distribute apps among multiple devices.
Instead of generating a single APK file, which is the final product or performs multiple tasks, developers can split a single APK into multiple APK files and generate multiple APK files for a single app. These APKs can perform specific tasks or can be compiled for specific devices with different hardware or software. Usually, multiple APKs are generated to test out a single app and its tasks on different screen sizes and CPU architecture.
Splitting a single APK into multiple is known as APK split and the significant goal of the process is to reduce the size of the APK to carry out different tasks irrespective of each other. These APKs can be screen density specific, ABI device specific or combined screen density-ABI device specific where ABI stands for app binary interface.
Process of APK Split and Reducing the Size
When APK Split is performed, multiple APKs are created which perform specific tasks as required by the developer who has completed Android development. The process does not reduce the size of the app by shrinking the in-app resources but creates new versions of the APK for certain tasks for the specified device type. These APKs contain only those resources, which are compatible with the specified devices. For example, if an APK is created for the HDPI screen while another one is created for the xxxHDPI screen. The first APK will only consist of HDPI resources while the other APK will consist of only xxxHDPI resources, thus reducing the APK size.
Requirement of Multiple APKs
One question that always arises is that why APK Split is even required. Aren’t the devices that are being used today having larger memory spaces encompassed? It is not wrong to think that the new age devices are loaded with memory but concurrently there exists a large number of users which still use devices with low memory, and a majority of users cannot be ignored. You can try to reduce the size of our APK to reach a maximum number of devices, or you can create a single APK, which requires a certain memory and screen size and will leave out anyone outside of the specified criteria. This can lead to loss of potential customers, which is bad for any venture.
Google Support for Multiple APKs
Google Supports developers who wish to create multiple APKs for their app that caters to different device configurations. Each APK that is created is an independent version of your app, but they are registered with the same Google Play Listing. For example, if Facebook has a different APK for devices with a screen size of 3 inches and 5 inches, they will be shown the same app in the Google Play Store but will receive different APK files when downloaded. This feature is useful when your app cannot reach all the devices with a single APK file of your app.
To help developers create and publish multiple APK files for multiple devices, Google Play allows the developers to publish different APKs to:
- Support different screen sizes and densities
- Support different device feature sets
- Support different platform versions.
- Support different CPU architectures
- Support different OpenGL texture compression formats
Creating Multiple APKS
While you are developing an app and need to create multiple APKs, it is advisable to follow a checklist from the very beginning to get the most out of your development phase.
- Make sure you need multiple APKs: it is advisable to confirm thoroughly that multiple APKs are required as a single APK has several advantages over multiple APKs.
- List your needs: Listing your needs and requirements can help you decipher how many APKs you require and the API range for each APK.
- Collaborate your codebase: whether you begin from scratch or create multiple APKs of an existing app, make sure you put all the common resources in a Library or Central Project for easier access.
- Create APKs: for every APK you wish to create, there should be a separate Android project.
To publish multiple APKS on Google Play Store, all the created APKs must have the same package name and should be signed with the same certificate. Once the APKs are created and match the conditions, you can post multiple APKs on the Google Play Store under the same app name to cater to a wider range of audience.
Author bio: Saurabh has worked globally for telecom and finance giants in various capacities. After working for a decade in Infosys and Sapient, he started his first startup, Lenro, to solve a hyperlocal book-sharing problem. He is interested in product, marketing, and analytics. His latest venture Hackr.io recommends the best Angular tutorial and online programming courses for every programming language. All the tutorials are submitted and voted by the programming community.