How You Can Reduce Your Apk Size With Android App Bundles

App size is important because the heavier the app gets the less effective it becomes. The study suggests that at every 5 MB increase in size, the download rate drops by 1 percent. Now that demands you to have a smaller size app,

That means you have to find the android app development India that will create a small app with the help of android bundle. Let's understand what is android bundle and how does it work before you hire a competent android application development company for the job.

Structure of Android App Bundle:

The bundle has a structure that entails all the assets, project structure and much more. It’s almost like apk structure. The bundle cannot be installed directly because it is more like a configuration file that would help the users to optimize their build. It also contains other android APK files like dex and manifest files.

That means you have to hire an app development company that can help you in creating a smaller app using bundles.

Image Source: Amazonaws

What is the App bundle?

Android App Bundle is the recent upload format for application on play store. It essentially includes DEX, byte code, manifest and resources that are needed to generate differently and optimize APK according to user specifications.

Since users have different CPU architectures and language preferences, it supports dynamic delivery. Google play generates APK according to user preferences from app bundle so that developers are not required to maintain multiple APK.

Let’s find out what is dynamic delivery so that you can deploy bundles small to reduce the size.

Image Source: Mobiili

What is dynamic delivery?

Google’s Dynamic Feature APK,s concept will help you in splitting your app into separate features and can be delivered to the users according to their dynamic needs. For example, your app might have a lot of features that would not be helpful to certain users and the app can deliver only the required features, not all.

That means it will give the right APK’s to the right users and it will also contain all kinds of support resources so that the app can work across all the devices.

How does it work?

App Bundle facilitates dynamic delivery that follows split APKs mechanism. Split APKs mechanism is a feature that has come into existence with the advent of Instant App on Android 5.0 (API Level 21) or on the higher version. As the name suggests it will split APK into three major APKs that will serve specific purposes according to their dynamic characteristics.

Base APK: Base APK contains basic codes and resources that other split APKs can access. The primary role is to offer basic functionality to the user as soon as they install the app.

Image Source: Ggpht

Configuration APKs: This contains, CPU architecture,   native libraries,, resources and language preference. That means you are likely to find a number of configuration APKs depending upon the CPU architecture, screen density and language preferences.

That means user-specific configuration would be downloaded whenever a user downloads an app along with basic APK.

Image Source: Mzstatic

Dynamic Feature APKs: This entail resources and codes according to screen density and it gets installed as on-demand or whenever necessary.

Google Play Instant: App bundles are designed to support instant apps. That means you can add an instant module to your app that will your user to have Google Play Instant experience where your users can try our app without having to install to their phone.

Image Source: 1.bp.blogspot

By enabling your app bundle on Instant or adding an instant module to it, you can offer users a Google Play Instant experience that lets them try your app or game without waiting to install it. However, the users can install the app while using it and this makes things so much more convenient.

Advantages of uploading an app bundle

App bundles enable you to optimize your APKs for various devices at one go. That means you have to create a sign and upload one artifact for multiple uses. After you build the artifact, then Google Play serves and manages the apps’ APKs for you.

Consequently, you do not have to deal with version codes separately for every combination of screen density, ABI and locale that you intend to support. It also helps you in taking advantage of the current improvements that get added during the delivery process.

Module creation to Reduce the APK Size with Android App Bundles

Image Source: Androidauthority

  • Bundles have smaller download sizes and smaller disk size
  • It enables you to use uncompressed native libraries that are essentially stored on the APK instead of the user’s smart device. Undoubtedly this reduces download sizes and installation times
  • Offers specific functionalities and configurations to the users that they need on demand rather than during the installation process
  • It also simplifies the build and releases management by eliminating the need for creating and publishing multiple APKs
  • As soon as you upload an app bundle to the Play Console, Google Play will send an optimized binary for the device.
  • For Android 5.0 and higher, Play will produce a base APK, configuration and dynamic feature APKs
  • Below the Android 5.0 version, Play will create multi-APKs server-side

To find the best android app development India that can create a smaller size app and take advantage of bundles.

Let’s understand the APK structure first before you could find android app development India that can reduce the size of the app using bundles.

Understanding the APK structure:

Before finding out how to reduce the size of your app, it's important to understand the structure of the app's APK. An APK file contains a ZIP archive that contains all the files that make your app that includes resource files, Java class files and file entailing compiled resources.

APK Structure

Image Source: Justamomentgoose

An APK contains the following directories:

META-INF/: this directory contains CERT.SF and CERT.RSA signature files including MANIFEST.MF manifest file.

Assets/: It carries app's assets that the app can pull using Asset Manager Object.

Res/: It entails all the resources that aren't injected or compiled into resources.arsc.

Lib/: /it has compiled code that is dynamic to the software layer of a processor. This directory has a sub-directory for every platform type, that includes armeabi, x86, x86_64 and mips, armeabi-v7a, arm64-v8a, An APK also would have the following file out of which the only AndroidManifest.xml is mandatory.

Resources.arsc: Contains compiled resources. This file has all the XML content from almost all thw configurations of the res/values/ folder. The packaging tool extracts this XML content and then compiles it to binary form and archives the content. This content ideally includes language strings and styles, including paths to content which is not included directly in the resources. arsc file, such as layout files and images.

classes.dex: Entails the classes compiled in the DEX file format decoded by the Dalvik/ART virtual machine.

AndroidManifest.xml: It has the core Android manifest file. This file has the lists of the name, version, access rights and referenced library files of the app. The file uses Android's binary XML format.

How You Can Reduce Your APK Size with Android App Bundles

Image Source: Tnwcdn

How to build an Android App bundle:

  1. You can create using Android Studio that requires Android Studio 3.2 Canary 14+ version or higher version

For both the ways, the app bundle will be available at/build/outputs/bundleVariant/you_app_bundle.aab

Disable configuration types APKs:

In case you want to disable split apk’s for specific and certain apps, then you can control t using build.gradle. Here s how it works.

android {

    // While building Android App Bundles, the splits block must be ignored.

    splits {...}

    // Instead, you can use the bundle block to control the specific types of configuration APKs

    // that you want your app bundle to support.

    bundle {

        language {

            // Specifies that the app bundle should not be able to support

            // configuration APKs for language resources. These

            // resources are alternatively packaged with each dynamic base and

            // dynamic feature APK.

            enableSplit = false

        }

        density {

            //  property is set to true by default.

            enableSplit = true

        }

        abi {

            // This particular property is set to true

            enableSplit = true

        }

    }

}

Image Source: Apksum

Publishing app bundle:

You should find android application Development Company that can publish the app bundle by enrolling in App signing by Google Play program to the Play Console. Play console is responsible for signing the generated apk before sending it to the user. Once you uploaded the app bundle, play console will carry out all background works and produce all possible apks. You might want to explore your app bundle. In fact, you can do by exploring Bundle Explorer tab on the Play console web portal. Let’s have a look before you hire android developer

Image Source: Mobincube

Test your App bundle

You must find an android application development company that can test the app bundle, there are two different ways of doing it that includes using internal test track on Play Console and using bundle tools during development. You have to check all the possible solution while testing.

// 1. Generate apks archive file and install it.

$ bundletool build-apks --bundle=<path to .aab>

--output=<out.apks>

$ bundletool build-apks --bundle=myapp_bundle.aab

--output=myapp.apks

$ unzip out.apks -d apks   // unzip archive file if you want to see each apk’s split.

// 2. Install on connected device.

$bundletool build-apks --bundle=myapp_bundle.aab

--output=myapp.apks

--connected-device

// 3. Generate apk for specific device

$bundletool build-apks --bundle=myapp_bundle.aab

--output=myapp.apks

--device-spec=pixel2.json

pixel2.json

{

  "supportedAbis": ["arm64-v8a", "armeabi-v7a", "armeabi"],

  "supportedLocales": ["en-US"],

  "screenDensity": 560,

  "sdkVersion": 27

}

// 4. You can also produce signed apk bundle from the CI tool.

$bundletool build-apks --bundle=myapp_bundle.aab

--output=myapp.apks

--ks=/Users/saurabh/keystore.jks

--ks-pass=file:/Users/saurabh/keystore.pwd

--key-pass=file:/Users/saurabh/key.pwd

// 5. Universal apk that would means master apk for all devices.

$bundletool build-apks --bundle=myapp_bundle.aab --output=myapp.apks –universal

Now, that you have understood how it works, you must know when to use dynamic delivery.

 

Image Source: Googleusercontent

When to modularize and exclude specific feature?

  • When a little fraction of your users use any certain feature
  • When any feature takes a significant amount of space in your app thus reducing the efficiency

The best way to use the app bundle:

Since it’s a tricky affair, you might not be able to do it on your own unless you are a pro. Therefore, you should search for the best Android App Development Company that has enough experience in building an app.

Make sure that you go through their service offering and look at a few as that they have built using bundles. This will ensure that you are with the right people.

In addition, you must speak extensively at them before using bundles. Your app’s features must be rightly verified before using bundles. So, ensure that you sit with the development team and find out how they are going to do it.

In addition, you should also seek advice and suggestion from them because techie folks with enough experience can tell you how it works and what features that you need.

Image Source: Slidesharecdn

Over to you:

The app market is growing as more and more people use apps. The study suggests that people spend more than 40 minutes using various Apps but they do not use apps that are heavy in size. Therefore, you should and must find the Android App Development Company that can create smaller size apps. The above-stated factors should help you in getting the best possible apps for your business.

That is not all you should also understand your user preferences before creating apps. The first thing that you should is to look at the big data and it will help you in identifying the features and their implications and applications.

The app bundles have come for rescue because more and more people dropped certain apps because they were less functional/ hence, you should hire android developer that can help you in creating the right app.

The bundles should be used by the most proficient technical people because it is highly skilled art to use bundles and create perfect apps. All you have to do is to search for the best android app development India and create the apps that your users would live to work. It is time to gain competitive advantage through best apps with the help of the best android application development company and it is also time to use app bundle for dynamic delivery so that your users can get what they want.

About the Author

Sourabh Sharma
I am an entrepreneur doing multitasking at any given point of time. One of my niches is working as a professional Writer where I share my views and opinions. I am very honest, sincere, and up-front blogger and jot down my unbiased opinions. In general, I prefer to write without being argumentative or contradicting anyone. To bash intelligence into some brains I might sound aggressive which is not at all offending, right?

Leave a Reply

Your email address will not be published. Required fields are marked *