Home » Android » Android Library Module vs Feature Module

Android Library Module vs Feature Module

Posted by: admin April 23, 2020 Leave a comment

Questions:

The latest update of Android Studio 3.0 allows creation of several module types. One of the new types is ‘Feature Module’ but I can’t find details about it

What is the difference between the existing Android Library Module and the Feature Module and why should I use the latter?

The only difference I can see is that a Feature module defines an Application in the manifest. Can/should these Features be used as standalone apps? In what way do they differ from the actual Application module in that case?

How to&Answers:

Feature modules are used in Instant apps and Android App Bundles so that when app requests a feature while using the instant app or App Bundles, the Play store loads only requested feature module code, and not others. In the case of Instant apps, once the user is done using the feature the code is discarded. If you are working on a regular app and not instant app, I think you should be using Android library module.

Android App Bundles will be used to break up your app into small chunks so that a user doesn’t have to download all of the code in your APK if they don’t need it.

Answer:

Maybe a litte updated version…

Android Library is for instance a feature that u will need in your app but maybe using in other Apps as well. This is basically a constant part of your application.

The Dynamic Feature Module (or Instant Dynamic Feature Module for Instant Apps) can be used for temporary or feature based applications.
Let’s say you have an Onboarding Process that requires a 80MB library scan module. So, when the user enters the onboarding the module will be requested and installed. Once the user finished your onboarding process the scan module isn’t needed anymore, so you can remove the module again from your app.

An other example: You created an app with subscription based features. As the user payed for your subscription.. 3 of 8 modules (features) are now accessible for the user and the feature/module is being installed on the users device.

So in conclusion, it might be wise or even necessary (max. APK sized reached) to use dynamic features to reduce your apps size.

Also see: