Google has released the first alpha of Room 3.0. Room is part of the library of Jetpack Architecture Components, and the new release is described as a major breaking version that focuses on Kotlin Multiplatform (KMP) and adds support for JavaScript and WebAssembly (WASM) on top of the existing Android, iOS and JVM desktop support.


As part of the Jetpack Architecture Components in Android, the Room persistence library provides an abstraction layer over SQLite that developers can use to perform operations on data. It offers compile-time verification of SQL queries, and annotations that minimize repetitive boilerplate code. The SQLite APIs are still more powerful, but Room is easy to use. It also means data can be cached locally so it is available even when the user’s device is offline. Android Jetpack is a suite of libraries for use in Android app development. 

Room 3.0 is a major version update of the existing Room 2. x package. The new version focuses on Kotlin Multiplatform (KMP). The core annotation APIs are kept the same along with the main components. 

The new version has a number of major breaking differences from Room 2.x. The SupportSQLite APIs are no longer supported, unless you are using the androidx.room3:room3-sqlite-wrapper. All database operations are now Coroutine APIs based. The code generation is Kotlin only, and Kotlin Symbol Processing (KSP) is required. 

The developers say generating only Kotlin code simplifies the codebase and development process, enabling faster iterations. This version also drops support for Java Annotation Processing (AP) and KAPT. Room 3.0 is solely a KSP (Kotlin Symbol Processing) processor, which the team says allows for better processing of Kotlin codebases without being limited by the Java language.

Room 3.0 adds support for Kotlin coroutines, making its APIs coroutine-first. Coroutines is the KMP-compatible asynchronous framework and making Room be asynchronous by nature is a critical requirement for supporting web platforms.

In terms of new functionality, Room 3.0 adds support for JavaScript and and WasmJS; and also adds custom DAO return types. The support for JS and WasmJS has resulted in some significant API changes. Specifically, many APIs in Room 3.0 are suspend functions since proper support for web storage is asynchronous. The SQLiteDriver APIs have also been updated to support the Web and a new web asynchronous driver is available.

Room 3 Alpha is available now. 

 


More Information

Jetpack Compose Website

Room 3.0 Release Notes.


Related Articles

Android Jetpack Compose Is Welcome, But What About The Churn?

Google Jetpack Compose UI Toolkit Now In Beta

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Facebook or Linkedin.

Banner


uno q book


 


Comments

Make a Comment or View Existing Comments Using Disqus

or email your comment to: comments@i-programmer.info