Migrating from XML to Jetpack Compose in an MVVM Android Project
Article Summary
Jyoti Sheoran from Getir shares how her team successfully migrated their multi-module MVVM Android app from XML to Jetpack Compose without breaking production. The secret? Their decoupled architecture made gradual migration actually work.
Getir's Android team tackled the daunting task of modernizing their UI layer while keeping the app stable. They documented their three-part migration strategy: UI layer conversion, navigation refactoring, and an optional shift to MVI architecture. The approach leverages Compose's interoperability with XML to migrate screen by screen.
Key Takeaways
- Started with easiest screens first, using ComposeView inside existing Fragments
- Jetpack Compose's XML interoperability allowed mixing both approaches during migration
- Removed fragments entirely after migrating to Compose Navigation
- Shifted to MVI architecture to leverage Compose's state management capabilities
- Gradual migration kept the app stable throughout the entire process
Critical Insight
Breaking the migration into UI layer, navigation, and architecture phases made the XML to Compose transition manageable without disrupting the live app.