Jetpack Compose
Android's modern UI toolkit — declarative, Kotlin-based UI. Compose replaces XML layouts with Kotlin composable functions (like React). Reactive, less code, easier testing. The recommended way to build Android UI. Works with Kotlin Multiplatform.
- New Android apps.
- Modern, declarative UI.
- Kotlin-first projects.
- Kotlin Multiplatform UI.
- Legacy codebases heavily invested in XML.
- When you need mature view libraries.
- Non-Kotlin projects.
Definition
Jetpack Compose is a declarative UI framework for Android. UI is a function of state (@Composable functions). No XML layouts. Recomposition updates UI when state changes. Material Design components built-in. Preview in Android Studio. Interop with Views.
Why it exists
XML layouts + findViewById were verbose and error-prone. Compose is declarative, reactive, and Kotlin-native — less code, fewer bugs, easier to reason about.
How it works
@Composable functions describe UI. State (remember, mutableStateOf) triggers recomposition. Modifiers for styling. LazyColumn for lists. Navigation Compose for routing. Interop with existing Views.
Scaling limits
Still maturing (some APIs in flux). Kotlin-only. Debugging recomposition can be tricky. Less mature than XML/Views for complex cases.
Cost shape
Free and open source.
Alternatives
- XML layouts + Views — Mature, verbose, imperative.
- Flutter — Cross-platform, different language/ecosystem.
- React Native — JS/React, bridge overhead.
Failure modes
- Recomposition bugs.
- API changes between versions.
- Kotlin-only.
- Interop complexity.