← Back to list

Dynamic Feature Modules in Android: Building Scalable & Modular Apps

✅ Introduction

Anand Jain · 2025-08-23 11:13 · 0 claps · 2.1 min read
#dynamic-module #android
Open on Medium ↗

Dynamic Feature Modules in Android: Building Scalable & Modular Apps

✅ Introduction

As Android apps grow in size and complexity, keeping them modular, efficient, and scalable becomes a challenge. Large apps often contain features that not every user needs immediately (e.g., payments, onboarding, AR, chat). Bundling everything into a single APK increases APK size, build time, and loading time.

This is where Dynamic Feature Modules (DFMs) come in. They allow developers to download features on demand, reducing initial APK size and improving user experience.

✅ What are Dynamic Feature Modules?

Dynamic Feature Modules are a part of Android App Bundles (AAB) architecture. Instead of shipping one large APK, you can split your app into base module (core functionality) and dynamic modules (features downloaded on demand).

Key Benefits:

  • Smaller APK size → Faster installs & updates.
  • On-demand feature download → Download features only when needed.
  • Better modularization → Easier maintainability for large teams.
  • Improved performance → Load features asynchronously.

✅ Real-Life Example

Imagine a travel booking app:

  • Core features: Search destinations, view offers → Base Module
  • Optional features:
  • Hotel Booking → Dynamic Module
  • Flight Booking → Dynamic Module
  • AR-based Destination Preview → Dynamic Module
  • Chat Support → Dynamic Module

When the user installs the app, only the Base Module is downloaded. If the user books a flight, the Flight Booking module is downloaded on demand.

✅ How to Implement Dynamic Feature Modules?

Step 1: Enable App Bundle in Gradle

In your app/build.gradle (base module):

android {
    bundle {
        language {
            enableSplit = false
        }
    }
}

Step 2: Create a Dynamic Feature Module

  • In Android Studio: File → New → New Module → Dynamic Feature Module
  • Select Base Module as dependency.

Your project structure:

app/ (Base module)
|-- search/
|-- dynamicfeatures/
    |-- hotelbooking/
    |-- flightbooking/

Step 3: Add Module in settings.gradle

include ':app'
include ':hotelbooking'
include ':flightbooking'

Step 4: Add Dependencies in Base Module

implementation project(":hotelbooking")
implementation project(":flightbooking")

✅ Downloading Module On-Demand

To install a feature dynamically, use Play Core API:

val manager = SplitInstallManagerFactory.create(context)
val request = SplitInstallRequest.newBuilder()
    .addModule("hotelbooking")
    .build()

manager.startInstall(request)
    .addOnSuccessListener {
        Toast.makeText(context, "Module downloaded!", Toast.LENGTH_SHORT).show()
    }
    .addOnFailureListener {
        Toast.makeText(context, "Failed: ${it.message}", Toast.LENGTH_SHORT).show()
    }

✅ Launching Feature After Download

Once the module is installed:

manager.addListener { state ->
    if (state.status() == SplitInstallSessionStatus.INSTALLED) {
        val intent = Intent()
        intent.setClassName(context, "com.example.hotelbooking.HotelBookingActivity")
        context.startActivity(intent)
    }
}

✅ Testing Dynamic Delivery

Use bundletool:

bundletool build-apks --bundle=my_app.aab --output=my_app.apks
bundletool install-apks --apks=my_app.apks

✅ Best Practices

✔ Keep Base Module as small as possible. ✔ Use Deferred Install for features most users will use (e.g., onboarding). ✔ Use Play Feature Delivery (install-time or conditional delivery). ✔ Test with BundleTool before publishing.

✅ Real-World Apps Using DFMs

  • Google Maps → AR Navigation is an optional module.
  • Booking.com → Certain booking features load on demand.
  • Snapchat → AR lenses are dynamically downloaded.

✅ Conclusion

Dynamic Feature Modules make Android apps lighter, faster, and modular, especially for super apps or apps with optional features. If you want to improve performance, reduce APK size, and enhance UX, DFMs are a must in 2025.


메타데이터
post_id
b63f64c4522b
slug
dynamic-feature-modules-in-android-building-scalable-modular-apps-b63f64c4522b
url
https://medium.com/@jainanand.jain2/dynamic-feature-modules-in-android-building-scalable-modular-apps-b63f64c4522b
canonical_url
https://medium.com/@jainanand.jain2/dynamic-feature-modules-in-android-building-scalable-modular-apps-b63f64c4522b
author_url
https://medium.com/@jainanand.jain2
status
ok
fetched_at
2026-07-24 23:44:46