Tokopedia Nathaniel Khuana May 17, 2022

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

Critical Insight

Dynamic Features delivered significant size savings for Tokopedia, but required custom tooling and workarounds for modularization, resource handling, and navigation challenges.

They also discovered a clever way to reduce app size after installation by uninstalling features users only need once.

About This Article

Problem

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.

Solution

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.

Impact

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.