What’s new within the Jetpack Compose April ’26 launch


Posted by Meghan Mehta, Android Developer Relations Engineer

What's new within the Jetpack Compose April '26 launch 1

Right now, the Jetpack Compose April ‘26 launch is steady. This launch comprises model 1.11 of core Compose modules (see the full BOM mapping), shared ingredient debug instruments, trackpad occasions, and extra. We even have a couple of experimental APIs that we’d love you to check out and provides us suggestions on.

To make use of at present’s launch, improve your Compose BOM model to:

implementation(platform("androidx.compose:compose-bom:2026.04.01"))

Adjustments in Compose 1.11.0

Coroutine execution in assessments

We’re introducing a significant replace to how Compose handles check timing. Following the opt-in interval introduced in Compose 1.10, the v2 testing APIs are actually the default, and the v1 APIs have been deprecated. The important thing change is a shift within the default check dispatcher. Whereas the v1 APIs relied on UnconfinedTestDispatcher, which executed coroutines instantly, the v2 APIs use the StandardTestDispatcher. Which means that when a coroutine is launched in your assessments, it’s now queued and doesn’t execute till the digital clock is superior.

This higher mimics manufacturing circumstances, successfully flushing out race circumstances and making your check suite considerably extra strong and fewer flaky.

To make sure your assessments align with customary coroutine habits and to keep away from future compatibility points, we strongly suggest migrating your check suite. Take a look at our complete  migration information for API mappings and customary fixes.

Shared ingredient enhancements and animation tooling

What's new within the Jetpack Compose April '26 launch 2

We’ve additionally added some helpful visible debugging instruments for shared components and Modifier.animatedBounds. Now you can see precisely what’s taking place underneath the hood—like goal bounds, animation trajectories, and what number of matches are discovered—making it a lot simpler to identify why a transition won’t be behaving as anticipated. To make use of the brand new tooling, merely encompass your SharedTransitionLayout with the LookaheadAnimationVisualDebugging composable.

LookaheadAnimationVisualDebugging(
    overlayColor = Colour(0x4AE91E63),
    isEnabled = true,
    multipleMatchesColor = Colour.Inexperienced,
    isShowKeylabelEnabled = false,
    unmatchedElementColor = Colour.Crimson,
) {
    SharedTransitionLayout {
        CompositionLocalProvider(
            LocalSharedTransitionScope offers this,
        ) {
            // your content material
        }
    }
}

Trackpad occasions

We’ve revamped Compose assist for trackpads, like built-in laptop computer trackpads, attachable trackpads for tablets, or exterior/digital trackpads. Primary trackpad occasions will now typically be thought of PointerType.Mouse occasions, aligning mouse and trackpad habits to raised match consumer expectations. Beforehand, these trackpad occasions had been interpreted as faux touchscreen fingers of PointerType.Contact, which led to complicated consumer experiences. For instance, clicking and dragging with a trackpad would scroll as a substitute of choosing. By altering the pointer kind these occasions have within the newest launch of Compose, clicking and dragging with a trackpad will not scroll.

We additionally added assist for extra sophisticated trackpad gestures as acknowledged by the platform since API 34, together with two finger swipes and pinches. These gestures are routinely acknowledged by parts like Modifier.scrollable and Modifier.transformable to have higher habits with trackpads.

These adjustments enhance habits for trackpads throughout built-in parts, with redundant contact slop eliminated, a extra intuitive drag-and-drop beginning gesture, double-click and triple-click choice in textual content fields, and desktop-styled context menus in textual content fields.

To check trackpad habits, there are new testing APIs with performTrackpadInput, which permit validating the habits of your apps when getting used with a trackpad. In case you have customized gesture detectors, validate habits throughout enter sorts, together with touchscreens, mice, trackpads, and styluses, and guarantee assist for mouse scroll wheels and trackpad gestures.

Earlier than After

Composition host defaults (Compose runtime)

We launched HostDefaultProvider, LocalHostDefaultProvider, HostDefaultKey, and ViewTreeHostDefaultKey to produce host-level providers instantly via compose-runtime. This removes the necessity for libraries to rely on compose-ui for lookups, higher supporting Kotlin Multiplatform. To hyperlink these values to the composition tree, library authors can use compositionLocalWithHostDefaultOf to create a CompositionLocal that resolves defaults from the host.

Preview wrappers

Android Studio customized previews is a brand new function that means that you can outline precisely how the contents of a Compose preview are displayed.

By implementing the PreviewWrapperProvider interface and making use of the brand new @PreviewWrapper annotation, you possibly can simply inject customized logic, comparable to making use of a particular Theme. The annotation may be utilized to a perform annotated with @Composable and @Preview or @MultiPreview, providing a generic, easy-to-use answer that works throughout preview options and considerably reduces repetitive code.

class ThemeWrapper: PreviewWrapper {

    @Composable

    override enjoyable Wrap(content material: @Composable (() -> Unit)) {

        JetsnackTheme {

            content material()

        }

    }

}

@PreviewWrapperProvider(ThemeWrapper::class)

@Preview

@Composable

non-public enjoyable ButtonPreview() {

    // JetsnackTheme in impact

    Button(onClick = {}) {

        Textual content(textual content = "Demo")

    }

}

Deprecations and removals

  • As introduced within the Compose 1.10 weblog publish, we’re deprecating Modifier.onFirstVisible(). Its title usually led to misconceptions, significantly inside lazy layouts, the place it might set off a number of instances throughout scrolling. We suggest migrating to Modifier.onVisibilityChanged(), which permits for extra exact handbook monitoring of visibility states tailor-made to your particular use case necessities.
  • The ComposeFoundationFlags.isTextFieldDpadNavigationEnabled flag was eliminated as a result of D-pad navigation for TextFields is now all the time enabled by default. The brand new habits ensures that the D-pad occasions from a gamepad or a TV distant first transfer the cursor within the given course. The main target can transfer to a different ingredient solely when the cursor reaches the tip of the textual content.

Upcoming APIs

Within the upcoming Compose 1.12.0 launch, the compileSdk will probably be upgraded to compileSdk 37, with AGP 9 and all apps and libraries that rely on Compose inheriting this requirement. We suggest maintaining updated with the newest launched variations, as Compose goals to promptly undertake new compileSdks to offer entry to the newest Android options. Make sure you take a look at the documentation right here for extra data on which model of AGP is supported for various API ranges.

In Compose 1.11.0, the next APIs are launched as @Experimental, and we stay up for listening to your suggestions as you discover them in your apps. Be aware that @Experimental APIs are offered for early analysis and suggestions and will endure vital adjustments or removing in future releases.

Kinds (Experimental)

We’re introducing a brand new experimental basis API for styling. The Type API is a brand new paradigm for customizing visible components of parts, which has historically been carried out with modifiers. It’s designed to unlock deeper, simpler customization by exposing a normal set of styleable properties with easy state-based styling and animated transitions. With this new API, we’re already seeing promising efficiency advantages. We plan to undertake Kinds in Materials parts as soon as the Type API stabilizes.

A fundamental instance of overriding a pressed state model background:

@Composable
enjoyable LoginButton(modifier: Modifier = Modifier) {
    Button(
        onClick = {
            // Login logic
        },
        modifier = modifier,
        model = {
            background(
                Brush.linearGradient(
                    listOf(lightPurple, lightBlue)
                )
            )
            width(75.dp)
            peak(50.dp)
            textAlign(TextAlign.Middle)
            externalPadding(16.dp)

            pressed {
                background(
                    Brush.linearGradient(
                        listOf(Colour.Magenta, Colour.Crimson)
                    )
                )
            }
        }
    ){
        Textual content(
            textual content = "Login",
        )
    }
}

What's new within the Jetpack Compose April '26 launch 3

MediaQuery (Experimental)

The brand new mediaQuery API offers a declarative and performant option to adapt your UI to its surroundings. It abstracts advanced data retrieval into easy circumstances inside a UiMediaScope, making certain recomposition solely occurs when wanted.

With assist for a variety of environmental indicators—from system capabilities like keyboard sorts and pointer precision, to contextual states like window measurement and posture—you possibly can construct deeply responsive experiences. Efficiency is baked in with derivedMediaQuery to deal with high-frequency updates, whereas the flexibility to override scopes makes testing and previews seamless throughout {hardware} configurations.

Beforehand, to get entry to sure system properties — like if a tool was in tabletop mode — you’d want to jot down a number of boilerplate to take action:

@Composable
enjoyable isTabletopPosture(
    context: Context = LocalContext.present
): Boolean {
    val windowLayoutInfo by
        WindowInfoTracker
            .getOrCreate(context)
            .windowLayoutInfo(context)
            .collectAsStateWithLifecycle(null)

    return windowLayoutInfo.displayFeatures.any { displayFeature ->
        displayFeature is FoldingFeature &&
            displayFeature.state == FoldingFeature.State.HALF_OPENED &&
            displayFeature.orientation == FoldingFeature.Orientation.HORIZONTAL
    }
}

@Composable
enjoyable VideoPlayer() {
    if(isTabletopPosture()) {
        TabletopLayout()
    } else {
        FlatLayout()
    }
}

Now, with UIMediaQuery, you possibly can add the mediaQuery syntax to question system properties, comparable to if a tool is in tabletop mode:

@OptIn(ExperimentalMediaQueryApi::class)
@Composable
enjoyable VideoPlayer() {
    if (mediaQuery { windowPosture == UiMediaScope.Posture.Tabletop }) {
        TabletopLayout()
    } else {
        FlatLayout()
    }
}

Take a look at the documentation and file any bugs right here.

Grid (Experimental)

Grid is a robust new API for constructing advanced, two-dimensional layouts in Jetpack Compose. Whereas Row and Column are nice for linear designs, Grid offers you the structural management wanted for screen-level structure and complicated parts with out the overhead of a scrollable listing.

Grid means that you can outline your structure utilizing tracks, gaps, and cells, providing acquainted sizing choices like Dp, percentages, intrinsic content material sizes, and versatile “Fr” models.

@OptIn(ExperimentalGridApi::class)

@Composable

enjoyable GridExample() {

    Grid(

        config = {

            repeat(4) { column(0.25f) }

            repeat(2) { row(0.5f) }

            hole(16.dp)

        }

    ) {

        Card1(modifier = Modifier.gridItem(rowSpan = 2)

        Card2(modifier = Modifier.gridItem(colmnSpan = 3)

        Card3(modifier = Modifier.gridItem(columnSpan = 2)

        Card4()

    }

}

You’ll be able to place objects routinely or explicitly span them throughout a number of rows and columns for precision. Better of all, it’s extremely adaptive—you possibly can dynamically reconfigure your grid tracks and spans to reply to system states like tabletop mode or orientation adjustments, making certain your UI appears nice throughout kind elements.

What's new within the Jetpack Compose April '26 launch 4

Take a look at the documentation and file any bugs right here.

FlexBox (Experimental)

FlexBox is a structure container designed for prime efficiency, adaptive UIs. It manages merchandise sizing and house distribution primarily based on obtainable container dimensions. It handles advanced duties like wrapping (wrap) and multi-axis alignment of things (justifyContent, alignItems, alignContent). It permits objects to develop (develop) or shrink (shrink) to fill the container.

@OptIn(ExperimentalFlexBoxApi::class)
enjoyable FlexBoxWrapping(){
    FlexBox(
        config = {
            wrap(FlexWrap.Wrap)
            hole(8.dp)
        }
    ) {
        RedRoundedBox()
        BlueRoundedBox()
        GreenRoundedBox(modifier = Modifier.width(350.dp).flex { develop(1.0f) })
        OrangeRoundedBox(modifier = Modifier.width(200.dp).flex { develop(0.7f) })
        PinkRoundedBox(modifier = Modifier.width(200.dp).flex { develop(0.3f) })
    }
}
What's new within the Jetpack Compose April '26 launch 5

Take a look at the documentation and file any bugs right here.

New SlotTable implementation (Experimental)

We’ve launched a brand new implementation of the SlotTable, which is disabled by default on this launch. SlotTable is the inner information construction that the Compose runtime makes use of to trace the state of your composition hierarchy, monitor invalidations/recompositions, retailer remembered values, and monitor all metadata of the composition at runtime. This new implementation is designed to enhance efficiency, primarily round random edits.

To attempt the brand new SlotTable, allow ComposeRuntimeFlags.isLinkBufferComposerEnabled.

Begin coding at present!

With so many thrilling new APIs in Jetpack Compose, and lots of extra developing, it is by no means been a greater time to migrate to Jetpack Compose. As all the time, we worth your suggestions and have requests (particularly on @Experimental options which can be nonetheless baking) — please file them right here. Completely satisfied composing!

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles