
Key Takeaways
- Compose 1.12 requires compileSdk 37 and a newer Android Gradle Plugin.
- Replace deprecated onFirstVisible and migrate UI tests to the v2 APIs.
- Compose 1.12 adds mesh gradients, wide color gamut, and keyed SideEffect.
- Experimental Styles, Grid, FlexBox, and MediaQuery can change, so wrap them.
- Apps targeting API 37 cannot lock orientation on large screens.
Overview: This guide explains what is new in Jetpack Compose 1.12 and the Compose 1.11 features that came before it, how they connect to Android 17, and how to upgrade your project step by step. Follow the steps carefully to ensure a smooth migration.
Jetpack Compose has moved fast in 2026. Version 1.11 brought adaptive layout APIs such as Styles, MediaQuery, Grid and FlexBox, and version 1.12 followed with mesh gradients, wide color gamut and HDR support, passkey-ready text fields, faster effects and better testing tools. Android 17 became stable on 16 June 2026, and Compose 1.12 now compiles against API 37.
In July 2026, Google also confirmed that Android UI development is Compose-first: new Android Studio UI tools are built for Compose only, while the View-based Layout Editor and Navigation Editor are in maintenance mode. This guide shows you what to use, what to avoid, and what to fix before you upgrade.
Last verified: 13 November 2026. Several APIs below are marked experimental and can change, so check the official documentation before you ship.
Before You Start
Make sure you have the following ready:
- Android Studio installed with SDK Platform API 37 downloaded from the SDK Manager.
- Your project under version control, with a clean working tree so you can roll back easily.
- A passing test suite, so you can tell migration breakage from existing failures.
- About an hour for a small app, or a full sprint for a large app with many custom tests.
Warning: Compose 1.12 raises the compileSdk to API 37 for every app and library that depends on it. This also raises the minimum Android Gradle Plugin version. Do not upgrade the BOM on its own without upgrading the build tools, or your build will fail.
Version overview
| Release | Date | Highlights |
|---|---|---|
| Compose 1.11 | 22 April 2026 | Test v2 APIs default, trackpad events, preview wrappers; experimental Styles, MediaQuery, Grid, FlexBox |
| Compose 1.12 | 12 August 2026 | compileSdk 37, mesh gradients, wide color gamut and HDR, keyed SideEffect, rich text editing, Credential Manager, named Grid areas |
| Compose 1.12.1 | September 2026 | Latest stable at the time of writing |
Step-by-Step: Upgrade to Compose 1.12
Step 1: Install the Android 17 SDK
Open Android Studio, go to Tools > SDK Manager, and install the SDK Platform for API 37. Compose 1.12 libraries will not compile without it.
Step 2: Update compileSdk
In your module-level Gradle file, raise compileSdk to 37. You can keep targetSdk where it is for now and raise it later, once you have tested Android 17 behavior changes.
android {
compileSdk = 37
defaultConfig {
minSdk = 24
targetSdk = 36 // raise to 37 after testing
}
}
Step 3: Upgrade the Android Gradle Plugin
Compose 1.12 requires a newer Android Gradle Plugin (AGP 9.x) to build against API 37. Google’s own pages state the exact minimum slightly differently across release notes (9.1.1, 9.1.2, and 9.2.0 all appear), so check the AGP compatibility table in the Compose setup documentation and pick the version it lists today. Update your version catalog or root build file accordingly, and update Gradle if Android Studio asks you to.
Tip: Use Android Studio’s AGP Upgrade Assistant (Tools > AGP Upgrade Assistant). It updates Gradle versions and flags deprecated build settings for you.
Step 4: Update the Compose BOM
Change the Compose Bill of Materials to the August 2026 release or newer. Because the BOM manages all Compose library versions together, you normally do not set individual versions.
dependencies {
val composeBom = platform("androidx.compose:compose-bom:2026.08.00")
implementation(composeBom)
androidTestImplementation(composeBom)
implementation("androidx.compose.ui:ui")
implementation("androidx.compose.material3:material3")
implementation("androidx.compose.foundation:foundation")
}
Step 5: Sync and fix compile errors
Sync the project and build. Library dependencies that were pinned to older versions may also demand compileSdk 37, so update libraries such as AndroidX core and OkHttp when the build tells you to. Fix any deprecation errors you see.
Step 6: Replace Modifier.onFirstVisible()
Modifier.onFirstVisible() is deprecated because its name led people to expect a single call, but inside lazy layouts it could fire many times while scrolling. Use Modifier.onVisibilityChanged(), which lets you track visibility thresholds precisely.
// Before (deprecated)
Modifier.onFirstVisible { trackImpression(item.id) }
// After: you decide when an item counts as "seen"
Modifier.onVisibilityChanged { visible ->
if (visible) trackImpression(item.id)
}
Note: The exact parameters of onVisibilityChanged let you set minimum visible fraction and duration. Check the API reference and pick values that match your analytics definition of an impression.
Step 7: Migrate your UI tests to the v2 testing APIs
Since Compose 1.11, the v2 testing APIs are the default and the v1 APIs are deprecated. The key change is the default test dispatcher. The old APIs used UnconfinedTestDispatcher, which ran coroutines immediately. The new APIs use StandardTestDispatcher, so a launched coroutine is queued and does not run until the virtual clock advances.
- This mimics production more closely and exposes race conditions that hid before.
- Some existing tests may start failing. This usually means the test relied on timing that is not guaranteed in real use.
- Follow Google’s Compose testing migration guide for API mappings and common fixes.
Step 8: Run the app and your full test suite
Run the app on an Android 17 emulator and on at least one older device. Then run your unit and UI tests. Fix failures one by one, and only then merge.
Tip: Do the upgrade on its own branch, with no other feature work. If something breaks, you will know the upgrade caused it.
What’s New in Compose 1.12
Mesh gradients
MeshGradientPainter creates multi-point, organic gradients by placing colored vertices on a grid. Instead of a simple two-color blend, you control the color at each corner or point, which is great for modern backgrounds, cards and hero banners.
val gradientPainter = remember {
MeshGradientPainter(rows = 1, columns = 1) {
// row, column, position, color
setVertex(0, 0, Offset(0f, 0f), Color.Red) // top-left
setVertex(0, 1, Offset(1f, 0f), Color.Blue) // top-right
setVertex(1, 0, Offset(0f, 1f), Color.Green) // bottom-left
setVertex(1, 1, Offset(1f, 1f), Color.Yellow) // bottom-right
}
}
Box(
modifier = Modifier
.aspectRatio(16 / 9f)
.fillMaxWidth()
.paint(gradientPainter)
)
Wide color gamut and HDR
Compose 1.12 supports Wide Color Gamut (Display P3) and HDR rendering across graphics, paint, and shaders. Colors defined in non-sRGB color spaces are preserved all the way to platform rendering instead of being clamped. Colors fall back safely to sRGB when the color space is unsupported, when the Android version is too old (for example, some HDR spaces on Android 13 and below), or on Android 9 and below.
Tip: Design your brand colors in Display P3 and test on a P3-capable phone. On devices without support, the app simply shows the sRGB fallback, so you do not need separate code paths.
Keyed SideEffect
SideEffect now accepts keys, so you can run a one-shot side effect whenever specific values change without creating a coroutine or a dispose block. Google reports it is up to 90% faster than LaunchedEffect and about 20% faster than DisposableEffect for these cases.
@Composable
fun AnalyticsTracker(userId: String, screenName: String) {
SideEffect(key1 = userId, key2 = screenName) {
analytics.logScreenView(userId, screenName)
}
}
Important: SideEffect runs before DisposableEffect and LaunchedEffect. Be careful when migrating a LaunchedEffect that relies on starting after the current frame completes, because the order of execution changes.
Credential Manager integration in text fields
Compose text fields can now integrate with Android’s Credential Manager on API 34 and higher through the Autofill framework. By attaching the new credentialRequest semantics property, a field can prompt for passkeys, saved credentials, or sign-in requests right inside the input flow. Below API 34, the androidx.credentials library handles it.
@Composable
fun LoginField(textFieldState: TextFieldState) {
val credentialData = remember {
CredentialRequestData(
// Specify your Credential Manager request options
)
}
BasicTextField(
state = textFieldState,
modifier = Modifier.semantics {
credentialRequest = credentialData
}
)
}
Rich text editing and selection control
BasicTextField can now carry inline character and paragraph formatting. Inside an edit block, call addStyle() with a SpanStyle or ParagraphStyle. Formatting persists across configuration changes, and you can read back the active styles from the TextFieldState.
val state = rememberTextFieldState("Formatted text in Compose 1.12")
state.edit {
addStyle(
SpanStyle(fontWeight = FontWeight.Bold, color = Color.Blue),
start = 0,
end = 9
)
}
val currentStyles = state.textStyles
A new SelectionState API gives you programmatic control over text selection inside a SelectionContainer, including selectAll(), clear(), select(TextRange) and extendSelectionByWord().
@Composable
fun ProgrammaticSelectionExample() {
val selectionState = rememberSelectionState()
Column {
Button(
onClick = { selectionState.selectAll() },
modifier = Modifier.disableSelectionClearOnTap()
) { Text("Select All") }
SelectionContainer(state = selectionState) {
Text("Text content to be selected programmatically.")
}
}
}
Named areas in Grid
The experimental Grid layout now supports named areas. Instead of tracking row and column numbers for every item, you define semantic regions once and place composables by name. This makes dashboards and adaptive screen layouts much easier to read.
@OptIn(ExperimentalGridApi::class)
@Composable
fun DashboardLayout() {
Grid(
config = {
area("header", row = 0, column = 0, rowSpan = 1, columnSpan = 2)
area("sidebar", row = 1, column = 0)
area("content", row = 1, column = 1)
gap(16.dp)
}
) {
HeaderSection(Modifier.gridItem(areaId = "header"))
NavigationSidebar(Modifier.gridItem(areaId = "sidebar"))
MainContentView(Modifier.gridItem(areaId = "content"))
}
}
Interactive two-stage transitions
New DeferredAnimatedContent and DeferredAnimatedVisibility composables let you create transitions that start under gesture control and then hand off to an automatic animation. The best example is predictive back: the screen follows the user’s swipe, and when the gesture ends, the animation completes smoothly with velocity carried over. A flag in SharedContentConfig controls whether shared elements transform with their parents during the deferred phase.
Faster startup and better tests
- Performance: Google focused on startup, and reports Time to Initial Display now comparable to Views in its benchmarks.
- Test APIs: hasPendingWork checks for pending UI work without advancing the clock, and runWithoutImplicitWait removes repeated synchronization when you query many nodes in one frame.
- Screenshot testing: captureToImage can now capture a popup or dialog together with its anchor.
What Arrived in Compose 1.11
Many 1.12 improvements build on Compose 1.11 (April 2026). These are worth knowing if you are upgrading from an older version.
Styles (experimental)
Styles are a new way to customize components. Instead of stacking modifiers, you describe background, size, padding, and state-based variations such as pressed in one style block, with animated transitions between states. Google has said the API will stay experimental and breaking changes are expected, so avoid it in long-lived production code for now.
Button(
onClick = { /* login */ },
style = {
background(Brush.linearGradient(listOf(lightPurple, lightBlue)))
width(75.dp)
height(50.dp)
externalPadding(16.dp)
pressed {
background(Brush.linearGradient(listOf(Color.Magenta, Color.Red)))
}
}
) { Text("Login") }
MediaQuery (experimental)
mediaQuery lets you adapt your UI to device and window conditions declaratively, such as posture, window size, keyboard type or pointer precision. Previously, checking for tabletop mode needed a lot of boilerplate with WindowInfoTracker.
@OptIn(ExperimentalMediaQueryApi::class)
@Composable
fun VideoPlayer() {
if (mediaQuery { windowPosture == UiMediaScope.Posture.Tabletop }) {
TabletopLayout()
} else {
FlatLayout()
}
}
Grid and FlexBox (experimental)
Grid gives you two-dimensional layouts with tracks, gaps and cells without the overhead of a scrolling list. FlexBox manages wrapping, growing, and shrinking of items inside a container, similar to CSS flexbox.
@OptIn(ExperimentalFlexBoxApi::class)
@Composable
fun FlexBoxWrapping() {
FlexBox(
config = {
wrap(FlexWrap.Wrap)
gap(8.dp)
}
) {
RedRoundedBox()
GreenRoundedBox(Modifier.width(350.dp).flex { grow(1.0f) })
OrangeRoundedBox(Modifier.width(200.dp).flex { grow(0.7f) })
}
}
Other 1.11 improvements
- Trackpad events: trackpad input is now treated as mouse input, so click and drag selects instead of scrolling, and two-finger swipes and pinches work in scrollable and transformable components. New performTrackpadInput test API.
- Preview wrappers: @PreviewWrapper applies a theme or custom behavior to a preview without repeating code, and from 1.12 it works with custom @MultiPreview classes.
- Shared element debugging: wrap your layout in LookaheadAnimationVisualDebugging to see bounds and matches while debugging shared element transitions.
- D-pad navigation in TextFields: now always on, which helps TV and gamepad users.
Warning: Experimental APIs require opt-in annotations and may change or disappear. Keep them behind your own wrapper functions so a future change touches one file, not your whole app.
Android 17 for Compose Developers
Android 17 (API level 37) reached stable on 16 June 2026. These are the changes most relevant to people building UI with Compose.
Orientation and resizability can no longer be locked on large screens
Apps targeting API 37 can no longer opt out of orientation and resizability restrictions on screens with a smallest width of 600dp or more. Manifest attributes and APIs such as screenOrientation, setRequestedOrientation(), resizeableActivity, minAspectRatio and maxAspectRatio are ignored there. Games (by app category) and screens below 600dp are not affected. Two Compose habits matter most:
// 1. Stop content stretching on wide screens
Column(
modifier = Modifier
.widthIn(max = 600.dp)
.fillMaxWidth()
.padding(16.dp)
)
// 2. Keep buttons reachable on short, wide windows
Column(
modifier = Modifier
.fillMaxSize()
.verticalScroll(rememberScrollState())
)
Also preserve state through configuration changes, test with DeviceConfigurationOverride, and use Compose UI Check to audit your UI for adaptivity. For the full picture, see our earlier guide on building for foldables and large screens.
New platform features you can build on
- Contact Picker: a standardized, browsable way for users to share contacts without granting broad contact access.
- Handoff: start an activity on one Android device and continue it on another, with deep linking to the same app on the receiving device.
- Bubbles: full multi-window behavior, which makes correct window-size handling even more important.
- MetricStyle notifications: a new template for fitness, timers, stopwatch, and travel use cases.
- Encrypted Client Hello: platform support that encrypts the server name during the TLS handshake, configured in your network security config.
- Profiling triggers: anomaly-based heap dumps and stack sampling to catch memory and binder problems early.
Tip: Because Compose 1.12 already compiles against API 37, you can use new platform APIs behind Build.VERSION.SDK_INT >= 37 checks while still supporting older devices.
Migration Checklist
| Done? | Task |
|---|---|
| ☐ | API 37 SDK installed; compileSdk set to 37 |
| ☐ | AGP upgraded to the minimum version Compose 1.12 requires |
| ☐ | Compose BOM at 2026.08.00 or newer |
| ☐ | onFirstVisible replaced with onVisibilityChanged |
| ☐ | Tests migrated to v2 APIs and passing |
| ☐ | Layouts capped with widthIn and scrollable on large screens |
| ☐ | State preserved across rotation and resize |
| ☐ | Experimental APIs isolated behind wrapper functions |
Common problems and fixes
- Build fails after updating the BOM: compileSdk or AGP is too old. Raise both, then sync.
- A library demands compileSdk 37: update that library, or keep it one release back until you are ready.
- Tests suddenly fail: the v2 StandardTestDispatcher queues coroutines. Advance the clock or use waitForIdle() where needed.
- Effects run in a different order: you switched a LaunchedEffect to keyed SideEffect. Revert it where timing matters.
Conclusion
Upgrading to Compose 1.12 comes down to a short list: install the API 37 SDK, raise compileSdk, upgrade AGP, update the BOM, replace onFirstVisible, and migrate your tests. Once that is done, you gain mesh gradients, wide color gamut, passkey-ready text fields, faster effects and richer text editing, along with a mature set of adaptive layout tools. Combined with Android 17’s large-screen rules, the best next step is to make your layouts width-aware and your state resilient, so your app looks right on every screen it runs on.
Frequently Asked Questions
Do I have to raise targetSdk to 37 to use Compose 1.12?
No. Compose 1.12 requires compileSdk 37, not targetSdk 37. You can compile against API 37 and keep your targetSdk lower until you have tested Android 17 behavior changes.
Is it safe to use Styles, Grid, FlexBox and MediaQuery in production?
They are marked as experimental, so APIs can change. Use them if you are comfortable updating code at each release, and keep them behind wrapper composables. Google has said Styles in particular should expect breaking changes.
Will mesh gradients and wide color gamut work on older phones?
Yes, with fallbacks. Colors fall back to sRGB when the device or Android version does not support the color space, so the app still renders correctly.
Should I still start new screens in XML Views?
Google has stated that Android UI development is Compose-first: new Android Studio UI tools are Compose-only, and the View-based Layout Editor and Navigation Editor are in maintenance mode. For new screens, Compose is the recommended choice.




