Android Inter-Module Navigation with Dagger
Article Summary
Robinhood's Android team cracked a tough modularization puzzle: how do you navigate between completely decoupled feature modules without creating dependencies?
Jin Cao from Robinhood Engineering shares their solution for inter-module navigation using Dagger's multibinding capabilities. This follow-up to their modularization story tackles the practical challenge of communication between independent feature modules while maintaining compile-time safety and fast build times.
Key Takeaways
- Uses Dagger multibinding to create navigation map without cross-module dependencies
- IntentKey classes provide compile-time safety for navigation arguments
- Debug builds gracefully handle missing modules to enable selective loading
- Developers can unload unused modules for faster builds without crashes
- Pattern works for activities, fragments, and views across independent modules
Critical Insight
Robinhood built a type-safe navigation system that lets developers work on isolated feature modules with faster build times while maintaining the ability to navigate between any part of the app.