Traveloka Alifa Nurani Putri

Dagger and Multi-Module Architecture in Traveloka Android App

Article Summary

Alifa Nurani Putri and Yusuf Cahyo Nugroho from Traveloka reveal how their single Dagger component ballooned to 17,705 lines of code across 25+ products. Their refactoring journey cut initialization time and build times while preparing for Dynamic Feature Modules.

Traveloka's Android team started with a simple Dagger setup in 2016, but as they scaled to 25+ products, their AppComponent became a god object with 82 modules and 36 subcomponents. This deep dive walks through their multi-year refactoring journey to fix build times, memory issues, and enable modularization.

Key Takeaways

Critical Insight

By splitting their monolithic Dagger component into product-specific api, base, and internal modules, Traveloka reduced initialization time by 39% and significantly improved incremental build times.

Continue reading

What This Article Covers

Problem

Traveloka's app module depended on all 25+ product modules in a diamond pattern. This meant that whenever any product module's public code changed, the app had to recompile during incremental builds. The result was 2+ minutes added to build times.

Solution

The team added a dagger-bridge pseudo-decoupling layer between the product modules and the app module. This isolated the product modules so only the bridge layer needed rebuilding when product code changed.

Impact

Incremental build times improved because Gradle skipped critical tasks like processDebugAnnotationsWithJavac and compileDebugJavaWithJavac when changes stayed within product modules. Gradle Enterprise analysis confirmed this optimization.

The article reveals why their attempt at Dynamic Feature Modules initially failed, and what they're planning to try next after completing the refactor.

This page summarizes “Dagger and Multi-Module Architecture in Traveloka Android App” by Traveloka, published Sep 9, 2019. All credit for the original work goes to the authors.

Read the original on medium.com (opens in new tab)

AI tools for Android

Browse all AI tools →