At its latest Google I/O conference, Google announced a new version of Jetpack, including updated architectural libraries, expanded application performance optimization support, Jetpack Compose 1.2, and more.
Jetpack is a suite of over 100 libraries and tools aimed at simplifying the creation of Android applications by reducing the standard, applying best practices and improving compatibility between devices. Google has announced new releases for a number of key components of Jetpack, including its room data persistence layer, the DataStore library for storing shared preferences, and the paging library.
Room, providing an abstraction layer on top of SQLite, has stable support for Kotlin symbol processing in version 2.4, achieving 2x speedup over the previous version by using Kotlin KAPT annotation processor. KSP is an API that can be used to create compiler plugins that can 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 of Room are support for JSON queries and simplified database migrations with new annotations and properties. Additionally, Room has begun its journey towards a complete rewrite of Kotlin, which will end in a future release.
DataStore is a coroutine-based asynchronous library for secure and easy-to-use management of application preferences in the form of key-value pairs. DataStore also supports typed objects using protocol buffers. DataStore is the new official library for storing preferences and Google provides guidance for migrating from SharedPreference.
Another library that has recently been extended is Paging, which allows for incremental data fetching to improve application performance and resource utilization. A typical use case for paging is to manage a long list of remote data items. Paging 3.1 brings stable support for Rx and Guava, which can be handy if you want to leverage Java code with Paging that would otherwise require Kotlin coroutines. Additionally, pagination can better represent invalid or stale data and empty pages.
Regarding application performance, Jetpack includes new base profiles, which can be used to provide metadata about code path usage, which the Android runtime can use to prioritize compilation ahead of time. and improve launch times. The new Macrobenchmark library extends Jetpack benchmarking to more complex use cases. For example, you can now instrument application 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 issues such as dropped frames.
Finally, Jetpack Compose has reached 1.2 beta, bringing text handling improvements, support for downloadable fonts, new lazy layout APIs to improve the performance of the UI capable of displaying on-demand content and beta support for Wear OS.