migrate-xml-views-to-jetpack-compose

Migrate Android XML View layouts to Jetpack Compose with validation.

6.6k|388|Updated Mar 16, 2026
One-click install
npx skills add https://github.com/android/skills --skill migrate-xml-views-to-jetpack-compose-android
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: migrate-xml-views-to-jetpack-compose
Source: https://github.com/android/skills/tree/main/jetpack-compose/migration/migrate-xml-views-to-jetpack-compose
Command: npx skills add https://github.com/android/skills --skill migrate-xml-views-to-jetpack-compose-android

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Migrating a legacy XML-based UI to Jetpack Compose without breaking layout, theming, or behavior.

Core Features & Use Cases

  • 10-step migration workflow: From choosing the best XML candidate through migration, validation, and safe cleanup.
  • Compose dependency + compiler setup: Ensures Compose builds cleanly before conversion work begins.
  • Theming and layout parity validation: Uses screenshot/baseline comparison and Compose Preview to achieve visual consistency.
  • Interop-aware replacement of usages: Updates call sites using Compose-in-Views and Views-in-Compose guidance.

Quick Start

Run the migration for a single XML layout by following the 10-step flow: identify the candidate, map the layout and dependencies, create the Compose version with Preview, validate with screenshot parity, then replace usages and remove the migrated XML only when it is safe to delete.

Frequently Asked Questions about migrate-xml-views-to-jetpack-compose

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I migrate XML layouts to Jetpack Compose without breaking existing functionality?

Migrate XML layouts to Jetpack Compose by following a 10-step workflow that includes optimal candidate selection, dependency checks, theming setup, conversion, and interop-based usage replacement. This structured approach preserves visual parity and functionality throughout the UI migration process.

What is the best way to validate visual parity when converting an Android XML View to Compose?

The best way to validate visual parity during XML to Compose migration is using Compose Preview alongside screenshot baseline comparison. This ensures the converted Jetpack Compose component matches the original Android XML View layout exactly before you replace callers.

Can I incrementally adopt Jetpack Compose in an existing Android XML View project?

You can incrementally adopt Jetpack Compose in existing Android projects by converting single XML layouts using interop guidance. The migration workflow supports Compose-in-Views and Views-in-Compose usage replacement, allowing gradual adoption without breaking the overall layout structure.

When is it safe to delete an XML layout file after migrating to Jetpack Compose?

It is safe to delete an XML layout file after migrating to Jetpack Compose only when the migrated XML is completely unreferenced. Cautious XML cleanup is the final step in the migration workflow, ensuring all callers have been successfully replaced with Compose components.

Do I need to set up Compose compiler and dependencies before starting an XML to Compose UI migration?

You need to set up the Compose compiler and check dependencies before starting an XML to Compose UI migration. Ensuring Compose builds cleanly before conversion work begins is a required step to prevent build failures during the layout migration process.