Getir Jyoti Sheoran Apr 28, 2023

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

Critical Insight

Breaking the migration into UI layer, navigation, and architecture phases made the XML to Compose transition manageable without disrupting the live app.

The article includes specific code examples showing how to refactor real fragments into Composables, plus the exact build.gradle setup needed to get started.

About This Article

Problem

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.

Solution

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.

Impact

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.