Android Development · Deep dive

Moving an Android App from XML Views to Jetpack Compose, One Screen at a Time

Jetpack Compose is now the recommended way to build new Android UI. Most teams with an established app, however, cannot stop and rewrite every screen. The good news is that Compose and XML views can coexist, so you can migrate one screen or component at a time.

Start with new screens and isolated components

Build new features in Compose, and convert small, self-contained components such as cards, list items and dialogs. These give the team experience with the new tools without touching the most complex screens.

Use interoperability in both directions

Compose can host Android views, and views can host Compose. Android's documentation on migrating XML views to Jetpack Compose describes the migration steps and the interop APIs for each direction.

Convert the state, not just the layout

The biggest gains come from moving state into a clear model that the UI reads from, instead of copying view logic line by line. Use a ViewModel that exposes state, and let the Compose UI render it. This also makes the screens easier to test.

Measure as you go

Watch recomposition counts, startup time and memory use on real devices, especially on mid-range hardware. Convert the most valuable screens first, and keep a short list of screens you intend to leave in XML until there is a clear reason to change them.

← Back to all articles

Need help with your next release?

Talk to Dragonfly