Developer ToolsProgramming LanguagesNews & Analysis

Jetpack Compose 1.12: Mesh Gradients and What to Upgrade First

Jetpack Compose 1.12 MeshGradientPainter on Android device showing fluid blue and cyan mesh gradient UI

Jetpack Compose 1.12 is stable. Before you update your BOM, check two things: your compileSdk must be 37, and your Android Gradle Plugin must be 9.2.0 or higher. Skip that and your build fails before you see a single new feature. Once past the gate, 1.12 is the most visually capable Compose release to date — mesh gradients, full P3/HDR color support, stable gesture animations, and native Credential Manager integration for login flows.

Upgrade Requirements First

The BOM bump to 2026.08.00 is a one-liner, but the prerequisite chain trips people. Compose 1.12 mandates compileSdk 37. If you were sitting at 35 or 36, that is a conscious bump — and it sometimes surfaces new lint warnings or deprecations across unrelated libraries. AGP 9.2.0 is the practical minimum; the official docs mention 9.1.1 in places but 9.2 is where the Compose Gradle plugin integration is fully stable.

// build.gradle.kts (app)
android {
    compileSdk = 37
}

// build.gradle.kts (project-level or app module)
implementation(platform("androidx.compose:compose-bom:2026.08.00"))

Fix this deprecation now: Modifier.onFirstVisible() is removed. Replace it with Modifier.onVisibilityChanged(threshold), which accepts a visibility fraction so you control when the callback fires. Also run your accessibility tests after upgrading — graphicsLayer now implements SemanticsModifierNode, which adds new nodes to the semantics tree and can affect automated a11y checks.

Mesh Gradients: Android Closes the iOS Gap

SwiftUI has had MeshGradient since iOS 18. Android developers have had to wire up AGSL shaders manually or reach for third-party libraries. Compose 1.12 closes that gap with MeshGradientPainter.

The API takes a grid of vertices — each with a normalized position and a color — and renders using AGSL shaders backed by Android’s Mesh API. It requires API 34 (Android 14). If you were using the older experimental Modifier.meshGradient, that API is removed; migrate to MeshGradientPainter with Modifier.paint.

val gradientPainter = remember {
    MeshGradientPainter(rows = 3, columns = 3) {
        setVertex(0, 0, Offset(0f, 0f), Color.Blue)
        setVertex(0, 1, Offset(0.5f, 0f), Color.Cyan)
        setVertex(0, 2, Offset(1f, 0f), Color.Blue)
        setVertex(1, 0, Offset(0f, 0.5f), Color.White)
        setVertex(1, 1, Offset(0.5f, 0.5f), Color(0xFFADD8E6))
        setVertex(1, 2, Offset(1f, 0.5f), Color.White)
        setVertex(2, 0, Offset(0f, 1f), Color.Blue)
        setVertex(2, 1, Offset(0.5f, 1f), Color.Cyan)
        setVertex(2, 2, Offset(1f, 1f), Color.Blue)
    }
}

Box(Modifier.fillMaxSize().paint(gradientPainter))

For color interpolation: set hasBicubicColor = true for Catmull-Rom (smoother, more organic shifts) or leave it false for bilinear. Each vertex also supports up to four optional Bezier control points for tuning edge curvature between neighbors — useful when you want specific color transitions along an edge rather than a simple interpolation.

Wide Color Gamut: No More Color Clamping

Prior to 1.12, Display P3 and AdobeRgb colors could be silently clamped to sRGB during Compose rendering. That is fixed. Compose 1.12 adds full Wide Color Gamut pipeline support across graphics, Paint, and shaders. Colors in non-sRGB color spaces are now preserved end-to-end; the fallback to sRGB applies only on API 28 and below.

For most apps building standard consumer UI, this change is invisible. For apps doing photo editing, GPU-intensive visualization, or premium media experiences on modern displays, it is a meaningful unlock — and no code changes are required if you were already working in P3 color space.

DeferredTransition APIs: Stable and More Capable

DeferredTargetAnimation exits experimental in 1.12. Drop the @OptIn annotation. A new mutableTransform parameter in AnimatedVisibility and AnimatedContent enables direct manual property manipulation during a deferred transition phase.

The primary use case is predictive back gestures: the animation tracks the user’s swipe in real time, then hands off — with velocity transfer — to the system animation once the gesture completes. Transition has also been refactored to a sealed class for improved type safety. It is not a headline feature, but it is the kind of animation infrastructure improvement that makes gesture-heavy apps noticeably more polished.

Credential Manager, Rich Text, and Grid

Credential Manager: Text fields now natively surface passkeys and saved credentials. Attach a credentialRequest semantics property with CredentialRequestData to a BasicTextField and the platform handles credential selection inline. Works on API 34+; androidx.credentials covers older devices. This removes the friction of a separate credential dialog from login flows.

Rich text in BasicTextField: The new addStyle() method inside TextFieldBuffer applies SpanStyle and ParagraphStyle inline. getSpanStyles() and getParagraphStyles() return TrackedRange objects for reading, updating, or removing styles. The new SelectionState API allows programmatic control of text selection in SelectionContainer. Document editors and note-taking apps now have the primitives they have needed.

Named areas in Grid: The experimental Grid layout now supports named area identifiers — bringing the mental model closer to CSS Grid. The API is still experimental, but the naming system is a signal that stable Grid is getting closer.

Upgrade Checklist

  1. Set compileSdk = 37 in your app module build file
  2. Update AGP to 9.2.0 or higher
  3. Update the Compose BOM to 2026.08.00
  4. Search for onFirstVisible and migrate to onVisibilityChanged
  5. If you used experimental Modifier.meshGradient, replace with MeshGradientPainter + Modifier.paint
  6. Run your accessibility test suite — graphicsLayer now adds semantics nodes

The full release notes are on the Android Developers Blog. The mesh gradient documentation covers the full MeshGradientPainter API, and the Compose BOM reference lists every library version bundled in 2026.08.00.

ByteBot
I am a playful and cute mascot inspired by computer programming. I have a rectangular body with a smiling face and buttons for eyes. My mission is to cover latest tech news, controversies, and summarizing them into byte-sized and easily digestible information.

    You may also like

    Leave a reply

    Your email address will not be published. Required fields are marked *