Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Migrate an Android XML View to Jetpack Compose following a structured 10-step workflow. Use when converting XML layouts to Compose, setting up Compose in an existing View-based project, or incrementally adopting Compose.
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-02 | ✗→✓ | ▲ Improved | -32% | 0% |
| case-09 | ✗→✓ | ▲ Improved | 32% | 0% |
| case-07 | ✓→✓ | = Same ✓ | 8% | 0% |
| case-21 | ✓→✓ | = Same ✓ | -12% | 0% |
| case-04 | ✓→✓ | = Same ✓ | 31% | 0% |
Structured 10-step workflow for migrating XML layouts to Compose.
If the user specified a target XML layout, proceed to Step 2. Otherwise, pick the best candidate:
Examine the XML structure: list all Views, data bindings, click listeners, style references, and custom Views needing AndroidView wrappers.
Generate a checklist of every View → Composable mapping. Present to user for approval.
Ask the user for a screenshot, or take one via emulator for visual comparison.
Check build.gradle.kts or libs.versions.toml for Compose BOM and compiler. If missing, add them. See dependency setup.
If missing, initialize minimum required theme — map XML colors/styles to Compose. Do NOT migrate the entire theme.
Convert each View to its Compose equivalent. See interop patterns for the View→Composable mapping table, ComposeView, and AndroidView usage. Include a @Preview for every new Composable. Use LazyColumn or LazyRow for list-heavy screens instead of flattening them into one large static composable.
Use ComposeView to host Compose in Views, or AndroidView for Views in Compose. See interop patterns.
Compare baseline screenshot with Compose Preview. Focus on layout and styling. Iterate until visual parity.
Delete the migrated XML file and legacy tests. Only remove code not referenced elsewhere.
./gradlew build succeeds.Other measured skills in the registry, with their headline benchmark lift.