Android has finished its 10 years anniversary recently. No one could have predicted this massive success. Android have changed the way the smartphones are developed and used, just like what iPhone did to the smartphone industry. When it comes to android development, many things have changed over the years, new OS version over other, etc.
However, there was one thing which remained the same –
Android application distribution model
Even the android market was changed to play store. But still it’s the same .apk file, developers were submitting to the play store. Honestly, apart from some information on usage statistics and basic distribution check list, play store was just a middle man for distributing your .apk files. There were no real benefits when it comes to apk optimization or support for app performance for the developer community.
Many a times I have stumbled upon questions like –
1) Why does developer need to build multiple apk’s to target different versions, screens, etc.?
2) Why do even a single change in the code ends up in updating entire Apk file? and so on.
The recently announced ‘Android App Bundles’ seems promising in resolving many of the issues.
So, what is an app bundle?
App bundle is a zip file which contains compiled code and resources. Unlike .apk file, .aab file will be generated and submitted to play store. The latest android studio 3.2 has this facility. App bundles defer the apk generation and signing to google play.
What do app bundles contain?
2) Assets/ resources / libs
3) Also, it generates a resource mapping table files (.pb) for assets, resources, etc. which is the key for forming generating different .apk files at a later stage
What about support for CI/CD?
If you are using any CI/CD tool like Jenkins, then there is a gradle command to generate the app bundles. Nothing really changes your build generation flow, except that you have to have gradle version of 4.6.
Now, let’s see different features provided by app bundle.
Feature 1 :: Smaller Apk files on targeted devices –
Once when the app bundle is uploaded to play store, it generates multiple apk’s called split apk’s. It generates base apk and multiple configuration apk (density, ABI, Language). Later, the designated (base+density+ABI+language) apk will be distributed for installation on the target devices using play store.
Does app bundle work for all the android versions?
Yes, from the developer perspective, it will be app bundles that will be submitted to the play store. However, the concept of split apk’s are supported only from Lollipop and above. In that case, for the android versions under 5.0, play store will generate multi-apk’s with ABI and density alone. They generally include all of the language in every generated APK.
So, for a given smart phone the density configuration and AIB configuration will be the same and won’t change over time. What happens when the user tries to change the default language in the device?
Play store will recognize this change for the list of applications which used dynamic delivery on the phone. Once when it senses a change, then it would automatically try to download the new language specific split apk. If it could not connect, then it would continue working on the same default language.
Feature 2 :: On-demand delivery of select modules –
Capability for users to install a piece of application and use it only when user need it. Also, additionally they can even uninstall the dynamic features from the app itself. User need not goto settings to uninstall dynamic features delivered through dynamic delivery. Rather installation and uninstallation of these extended modules are user experience within the app itself.
This is definitely going to change the way the applications will be architected.
‘Multiple apps versus single app with multiple on demand features’.
Let us take the example of Facebook. Currently Facebook and Facebook Messenger are 2 different apps. I am sure this was built this way to have good user experience and also to make 2 light weight apps and not one heavy weight apps. But with dynamic features in place we can even re-architect the FB apps as one app and render the Messenger app as dynamic feature or the vice versa.
Now let us take an enterprise employee productivity application which may have variety of features like timesheet, appraisals, feedback, helpline, support desk, etc. With dynamic features the base app may just contain the authentication and the list of apps alone. All of the functionalities under every productivity tool can be served on demand taking advantage of dynamic features using dynamic delivery.
Feature 3 :: Instant apps support through bundles –
We all know the purpose of instant apps. Instant app gives the user a chance to experience and try the app without even installing the app.
Android app bundle consolidates even instant app generation efforts within its umbrella. App links are still the same as how we used to do for instant apps earlier.
The change is in the way we declare intent filters in the manifest file and the way declare productFlavors in build.gradle.
How to release instant apps in play store?
Once when app bundle is generated then navigate to android instant apps tab in google play developer console and submit your app bundle. This is the same as old instant apps distribution. You submit the app bundle in instant apps section separately.
Finally, how do I test all of these features that was discussed above?
All of these features can be tested in 2 ways. I would like to call this as dev testing and QA testing.
1) Dev testing – You can use BundleTool to test all of these features.
2) QA testing – We can create internal test in google play console and make it available for selected QA testers.
It will be interesting to know how android app bundle is going to change the way applications will be architected and distributed over time.