Jetpack Compose comes to Android Wear OS, plus 1.2 update for smartphones and tablets

Google has released Compose for Wear OS 1.0, the first stable release of this user interface toolkit for its smartwatch platform. Jetpack Compose 1.2 for smartphones and tablets is also released, with new features including lazy grids, improved animation support, improved window insets (to deal with areas of a window that may be covered by system components), and better mouse support.

Date pickers in Google’s official Horologist library which supplements Compose for Wear OS

Jetpack Compose 1.0 was released in July 2021, replacing earlier XML-based layouts with a new declarative UI toolkit built with Kotlin and designed to work with Google’s Material Design system.

Google said this week that “Compose is our recommended way to build new Android apps for phone, tablets and foldables.”

Developers of smartwatch apps have been left behind until now, but the new release means that all the main Android platforms are included. Google’s Kseniia Shumelchyk, Android Developer Relations Engineer, said: “Compose-based UIs in most cases result in less code and accelerate the development process.” A new project template for Compose for Wear OS is in Android Studio Dolphin, the preview release of the next official Android IDE, based on JetBrains IntelliJ IDEA Community Edition.

Smartphone app developers got some important updates in Compose 1.2. Lazy grids, which improve performance by composing only the visible part of the grid, have moved from experimental to stable. The WindowInsets class, which handles unavailable areas of the screen and their interaction with an application window, is a new class based on previous work in the Accompanist library, used by Google to trial new features for Compose and to fill gaps in the API. Easing curves have been added to the animation support, for effects such as speeding up quickly and slowing down gradually. There is also nested scrolling support and new mouse events, as well as various bug fixes.

There are a number of ways to develop for Android, including Google’s cross-platform Flutter which uses the Dart language, or other approaches such as React Native. Jetpack Compose is the closest thing to a native solution, offering excellent support for Android features without attempting to be cross-platform (though non-visual code written in Kotlin could be used elsewhere as well).

“You should be investing on Jetpack  … Flutter is all good for simple apps but not suitable for complex scenarios,” claimed one developer on Hacker News. Another said there is a “big upfront cost” of learning the Compose framework and its quirks, but nevertheless it is the “future of dev [the] android frontend experience.”

This presumes that cross-platform support is not a goal; if it is, then a different framework may be worthwhile despite the trade-offs.