The Benefits and Challenges of Android Dynamic Feature in Tokopedia
Article Summary
Tokopedia cut their Android app download size by 10% using Dynamic Features. But the implementation wasn't as simple as Google's docs suggested.
The Tokopedia engineering team shares their real-world experience implementing Android Dynamic Feature modules in a large, complex production app. They moved seller features into on-demand modules that only download when users actually need them.
Key Takeaways
- Saved 3MB (10% of install size) by making seller features download on demand
- Nested library dependencies broke compilation until moved to base app
- Resource references from libraries crashed until using full package names
- Built custom navigation tool to handle module installation transparently
- Download size differs from app size: 28.76MB download became 36.77MB installed
Dynamic Features delivered significant size savings for Tokopedia, but required custom tooling and workarounds for modularization, resource handling, and navigation challenges.
About This Article
Dynamic Feature modules were crashing at runtime because CustomImageView classes kept pointing to library resource IDs that didn't exist in the feature module context.
Nathaniel Khuana's team built extension classes that inherit from the library components. This let Dynamic Features override layouts like custom_image_view.xml without breaking how resources were resolved.
The custom tooling automated resource package name corrections across large modules. Without it, the team would have had to fix the code manually, one piece at a time, which wasn't practical given how complex Tokopedia's architecture is.