At its latest Google I/O conference, Google announced a new Jetpack release, including updated architectural libraries, extended support for app performance optimization, Jetpack Compose 1.2, and more.
Jetpack is a suite of over 100 libraries and tools aimed to simplify the creation of Android apps by reducing boilerplate, enforcing best practices, and improving compatibility across devices. Google has announced new releases for a number of key Jetpack components, including its Room data persistence layer, the DataStore library for shared preferences storage, and the Paging library.
Room, providing an abstraction layer over SQLite, has stable support for Kotlin Symbol Processing in version 2.4, getting a 2x speed-up over the previous version using Kotlin annotation processor KAPT. KSP is an API that can be used to create compiler plugins able to understand and process Kotlin programs. A simplified view of KSP is that of a symbol preprocessor that can be used to generate code to feed into the compiler. Other notable features in Room are support for JSON queries and simplified database migrations thanks to new annotations and properties. In addition, Room has started its journey towards a complete Kotlin rewrite, which will complete in a future version.
DataStore is a coroutine-based asynchronous library to enable type-safe and easy-to-use management of app preferences in the form of key-value pairs. DataStore also supports typed objects using protocol buffers. DataStore is the new official library to store preferences and Google provides guidance to migrate from SharedPreference.
Another library that has been recently extended is Paging, which enables to fetch data incrementally to improve app performance and resource usage. A typical use case for Paging is handling a large list of remote data items. Paging 3.1 brings stable support for Rx and Guava, which can be handy if you want to leverage some Java code with Paging, which would otherwise require Kotlin coroutines. Additionally, Paging can better represent invalid or stale data and empty pages.
On the front of app performance, Jetpack includes new Baseline Profiles, which can be used to provide metadata about code path usage, which the Android runtime can use to prioritize ahead-of-time compilation and improve launch times. The new Macrobenchmark library extends Jetpack benchmarking to more complex use-cases. For example, you can now instruments app startup and UI operations such as scrolling a RecyclerView or animations. Macrobenchmark can also be used to generate Baseline Profiles. Google has also released a new JankStats library to detect and fix UI rendering problems like dropped frames.
As a final note, Jetpack Compose reached version 1.2 beta, bringing text handling improvements, support for downloadable fonts, new lazy layout APIs to improve the performance of UI able to show content on-demand, and beta support for Wear OS.