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
Breaking the migration into UI layer, navigation, and architecture phases made the XML to Compose transition manageable without disrupting the live app.
About This Article
Getir's Android project used MVVM architecture across multiple modules with XML-based layouts. The team needed to move to Jetpack Compose while keeping fragments, ViewModels, domain, and repository layers stable.
The team configured Compose in build.gradle and added compose_version 1.1.0-alpha04 dependencies. They created reusable color and dimension resources that all project modules could access.
This phased approach let Getir migrate one screen at a time, starting with simpler screens like ProfileScreen. The live app stayed stable and the existing architecture didn't need a complete rewrite.