HomeMobileWhat's New in Jetpack Compose

What’s New in Jetpack Compose



What’s New in Jetpack Compose

Posted by Nick Butcher – Product Supervisor

At Google I/O 2025, we introduced a number of options, efficiency, stability, libraries, and instruments updates for Jetpack Compose, our advisable Android UI toolkit. With Compose you’ll be able to construct glorious apps that work throughout gadgets. Compose has matured quite a bit because it was first introduced (at Google I/O 2019!) and we’re now seeing 60% of the highest 1,000 apps within the Play Retailer corresponding to MAX and Google Drive use and adore it.

New Options

Since I/O final yr, Compose Invoice of Supplies (BOM) model 2025.05.01 provides new options corresponding to:

    • Autofill assist that lets customers routinely insert beforehand entered private data into textual content fields.
    • Auto-sizing textual content to easily adapt textual content measurement to a mum or dad container measurement.
    • Visibility monitoring for once you want high-performance data on a composable’s place in its root container, display screen, or window.
    • Animate bounds modifier for lovely automated animations of a Composable’s place and measurement inside a LookaheadScope.
    • Accessibility checks in exams that allow you to construct a extra accessible app UI by way of automated a11y testing.

LookaheadScope {
    Field(
        Modifier
            .animateBounds(this@LookaheadScope)
            .width(if(inRow) 100.dp else 150.dp)
            .background(..)
            .border(..)
    )
}

moving image of animate bounds modifier in action

For extra particulars on these options, learn What’s new within the Jetpack Compose April ’25 launch and take a look at these talks from Google I/O:

If you happen to’re trying to check out new Compose performance, the alpha BOM affords new options that we’re engaged on together with:

    • Pausable Composition (see beneath)
    • Updates to LazyLayout prefetch
    • Context Menus
    • New modifiers: onFirstVisible, onVisbilityChanged, contentType
    • New Lint checks for ceaselessly altering values and components that needs to be remembered in composition

Please check out the alpha options and present suggestions to assist form the way forward for Compose.

Materials Expressive

At Google I/O, we unveiled Materials Expressive, Materials Design’s newest evolution that helps you make your merchandise much more partaking and simpler to make use of. It is a complete addition of recent elements, kinds, movement and customization choices that make it easier to to construct lovely wealthy UIs. The Material3 library within the newest alpha BOM accommodates most of the new expressive elements so that you can check out.

moving image of material expressive design example

Be taught extra to begin constructing with Materials Expressive.

Adaptive layouts library

Creating adaptive apps throughout kind components together with telephones, foldables, tablets, desktop, automobiles and Android XR is now simpler with the newest enhancements to the Compose adaptive layouts library. The steady 1.1 launch provides assist for predictive again gestures for smoother transitions and pane growth for extra versatile two pane layouts on bigger screens. Moreover, the 1.2 (alpha) launch provides extra flexibility for the way panes are displayed, including methods for reflowing and levitating.

moving image of compose adaptive layouts updates in the Google Play app

Compose Adaptive Layouts Updates within the Google Play app

Be taught extra about constructing adaptive android apps with Compose.

Efficiency

With every launch of Jetpack Compose, we proceed to prioritize efficiency enhancements. The newest steady launch contains important rewrites and enhancements to a number of sub-systems together with semantics, focus and textual content optimizations. Better of all these can be found to you just by upgrading your Compose dependency; no code adjustments required.

bar chart of internal benchmarks for performance run on a Pixel 3a device from January to May 2023 measured by jank rate

Inside benchmark, run on a Pixel 3a

We proceed to work on additional efficiency enhancements, notable adjustments within the newest alpha BOM embrace:

    • Pausable Composition permits compositions to be paused, and their work break up up over a number of frames.
    • Background textual content prefetch permits textual content format caches to be pre-warmed on a background thread, enabling sooner textual content format.
    • LazyLayout prefetch enhancements enabling lazy layouts to be smarter about how a lot content material to prefetch, profiting from pausable composition.

Collectively these enhancements get rid of almost all jank in an inside benchmark.

Stability

We have heard from you that upgrading your Compose dependency might be difficult, encountering bugs or behaviour adjustments that stop you from staying on the newest model. We have invested considerably in bettering the soundness of Compose, working carefully with the numerous Google app groups constructing with Compose to detect and forestall points earlier than they even make it to a launch.

Google apps develop in opposition to and launch with snapshot builds of Compose; as such, Compose is examined in opposition to the lots of of 1000’s of Google app exams and any Compose points are instantly actioned by our group. We now have just lately invested in rising the cadence of updating these snapshots and now replace them each day from Compose tip-of-tree, which implies we’re receiving suggestions sooner, and are in a position to resolve points lengthy earlier than they attain a public launch of the library.

Jetpack Compose additionally depends on @Experimental annotations to mark APIs which might be topic to alter. We heard your suggestions that some APIs have remained experimental for a very long time, decreasing your confidence within the stability of Compose. We now have invested in stabilizing experimental APIs to offer you a extra stable API floor, and lowered the variety of experimental APIs by 32% within the final yr.

We now have additionally heard that it may be arduous to debug Compose crashes when your individual code doesn’t seem within the stack hint. Within the newest alpha BOM, we’ve added a brand new opt-in function to offer extra diagnostic data. Observe that this doesn’t presently work with minified builds and comes at a efficiency value, so we suggest solely utilizing this function in debug builds.

class App : Utility() {
   override enjoyable onCreate() {
        // Allow just for debug taste to keep away from perf impression in launch
        Composer.setDiagnosticStackTraceEnabled(BuildConfig.DEBUG)
   }
}

Libraries

We all know that to construct nice apps, you want Compose integration within the libraries that work together along with your app’s UI.

A core library that powers any Compose app is Navigation. You advised us that you simply usually encountered limitations when managing state hoisting and instantly manipulating the again stack with the present Compose Navigation resolution. We went again to the drawing-board and utterly reimagined how a navigation library ought to combine with the Compose psychological mannequin. We’re excited to introduce Navigation 3, a brand new artifact designed to empower you with larger management and simplify complicated navigation flows.

We’re additionally investing in Compose assist for CameraX and Media3, making it simpler to combine digicam seize and video playback into your UI with Compose idiomatic elements.

@Composable
non-public enjoyable VideoPlayer(
    participant: Participant?, // from media3
    modifier: Modifier = Modifier
) {
    Field(modifier) {
        PlayerSurface(participant) // from media3-ui-compose
        participant?.let {
            // customized play-pause button UI
            val playPauseButtonState = rememberPlayPauseButtonState(it) // from media3-ui-compose
            MyPlayPauseButton(playPauseButtonState, Modifier.align(BottomEnd).padding(16.dp))
        }
    }
}

To be taught extra, see the media3 Compose documentation and the CameraX samples.

Instruments

We proceed to enhance the Android Studio instruments for creating Compose UIs. The newest Narwhal canary contains:

    • Resizable Previews immediately present you the way your Compose UI adapts to totally different window sizes
    • Preview navigation enhancements utilizing clickable names and elements
    • Studio Labs 🧪: Compose preview era with Gemini shortly generate a preview
    • Studio Labs 🧪: Rework UI with Gemini change your UI with pure language, instantly from preview.
    • Studio Labs 🧪: Picture attachment in Gemini generate Compose code from photos.

For extra data learn What’s new in Android growth instruments.

moving image of resizable preview in Jetpack Compose

Resizable Preview

New Compose Lint checks

The Compose alpha BOM introduces two new annotations and related lint checks that will help you to jot down right and performant Compose code. The @FrequentlyChangingValue annotation and FrequentlyChangedStateReadInComposition lint examine warns in conditions the place perform calls or property reads in composition may trigger frequent recompositions. For instance, frequent recompositions may occur when studying scroll place values or animating values. The @RememberInComposition annotation and RememberInCompositionDetector lint examine warns in conditions the place constructors, capabilities, and property getters are known as instantly inside composition (e.g. the TextFieldState constructor) with out being remembered.

Joyful Composing

We proceed to spend money on offering the options, efficiency, stability, libraries and instruments that you want to construct glorious apps. We worth your enter so please share suggestions on our newest updates or what you’d prefer to see subsequent.

Discover this announcement and all Google I/O 2025 updates on io.google beginning Could 22.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments