Room 3.0: A New Era for Android Database Development

Image of the author

Germán Bustamante @germanbustamante

Room 3.0 database architecture with Kotlin Multiplatform targets

Room 3.0: A New Era for Android Database Development

This post draws from the official sources:

Full credit to the Android team at Google. I recommend reading both for the complete technical picture.

🧠 This Is Not an Incremental Update

Let me be upfront: Room 3.0 is not Room 2.9. It is a ground-up rethinking of what Room is and what platforms it targets. The changes are significant enough that Google gave it a new Maven group (androidx.room3) and a new package namespace — a clear signal that this is meant to coexist with Room 2.x rather than silently replace it.

The headline features — KMP support for JS/WASM, coroutines-first APIs, Kotlin-only codegen — are exciting. But what I find most interesting is what Google chose to remove. Room 3.0 drops SupportSQLite, drops KAPT, drops Java code generation, and drops blocking DAO functions. Every removal is a bet on where Android development is going: Kotlin everywhere, coroutines everywhere, multiplatform everywhere.

For teams that have been gradually modernizing their Android stack, Room 3.0 validates every decision you have made. For teams still on Java or KAPT — this is the deadline.

🔄 What Changed: The Four Pillars

1. SupportSQLite Is Gone

This is the most impactful breaking change. SupportSQLite was Room’s abstraction layer over Android’s SQLite APIs. It was Android-specific by design, which made it impossible to run Room on iOS, desktop, or the web.

Room 3.0 replaces it entirely with the androidx.sqlite driver APIs — a clean, platform-agnostic abstraction that enables multiplatform support.

Before (Room 2.x):

roomDatabase.runInTransaction {
    // blocking transaction
}

roomDatabase.query("SELECT * FROM Song").use { cursor ->
    while (cursor.moveToNext()) {
        // read from cursor
    }
}

After (Room 3.0):

roomDatabase.withWriteTransaction {
    // suspend transaction
}

roomDatabase.useReaderConnection { connection ->
    connection.usePrepared("SELECT * FROM Song") { stmt ->
        while (stmt.step()) {
            val title = stmt.getText(0)
        }
    }
}

The new APIs are more explicit and inherently asynchronous. The mental model shifts from “I have a database handle” to “I borrow a connection for a specific operation.” If you have used JDBC or other connection-pool-based systems, this will feel familiar.

2. Kotlin-Only, KSP-Only

Room 3.0 generates exclusively Kotlin code and requires KSP (Kotlin Symbol Processing). KAPT and Java annotation processing are no longer supported.

This is not just a philosophical choice — it has practical benefits:

If your project still uses KAPT for Room, start the KSP migration now with Room 2.x — it is a prerequisite for 3.0.

3. Coroutines Are Mandatory

Every DAO function in Room 3.0 must be a suspend function unless it returns a reactive type like Flow. Blocking DAO functions are gone.

@Dao
interface SongDao {
    @Query("SELECT * FROM Song")
    suspend fun getAllSongs(): List<Song>  // must be suspend

    @Query("SELECT * FROM Song")
    fun observeSongs(): Flow<List<Song>>   // Flow is fine (inherently async)

    @Insert
    suspend fun insertSong(song: Song)     // must be suspend
}

This is not arbitrary — it is required for web platform support. JavaScript has no concept of blocking threads, so the entire API surface had to become asynchronous. But even for Android-only projects, this is a good change: it eliminates an entire class of “accidentally called on the main thread” bugs.

Room-level APIs follow the same pattern. InvalidationTracker no longer uses observers — it exposes a Flow:

fun getArtistTours(from: Date, to: Date): Flow<Map<Artist, TourState>> {
    return db.invalidationTracker.createFlow("Artist").map { _ ->
        val artists = artistsDao.getAllArtists()
        val tours = tourService.fetchStates(artists.map { it.id })
        associateTours(artists, tours, from, to)
    }
}

4. Web Platform Support (JS + WASM)

Room now runs in the browser. The WebWorkerSQLiteDriver executes database operations in a Web Worker and persists data using the Origin Private File System (OPFS).

fun createDatabase(): MusicDatabase {
    return Room.databaseBuilder<MusicDatabase>("music.db")
        .setDriver(WebWorkerSQLiteDriver(createWorker()))
        .build()
}

This is fascinating from an architecture perspective. A single Room database definition, with its entities, DAOs, and migrations, can now target Android, iOS, JVM desktop, JavaScript, and WebAssembly. The Kotlin code is identical — only the driver differs per platform.

📦 The New Package Structure

Room 3.0 lives under androidx.room3:

dependencies {
    val roomVersion = "3.0.0-alpha02"
    implementation("androidx.room3:room3-runtime:$roomVersion")
    ksp("androidx.room3:room3-compiler:$roomVersion")

    // Optional - return type converters
    implementation("androidx.room3:room3-paging:$roomVersion")
    implementation("androidx.room3:room3-livedata:$roomVersion")
    implementation("androidx.room3:room3-rxjava3:$roomVersion")
}

Import paths change accordingly:

// Before
import androidx.room.RoomDatabase
import androidx.room.Entity

// After
import androidx.room3.RoomDatabase
import androidx.room3.Entity

The separate namespace is intentional — it prevents conflicts with Room 2.x, which is important because libraries like WorkManager still depend on Room 2.x transitively.

🔌 Custom DAO Return Types

One of the more underrated additions: @DaoReturnTypeConverter lets you teach Room to return custom types from DAOs without waiting for official support.

Previously, Room had hardcoded support for LiveData, Flow, RxJava types, and PagingSource. In 3.0, even these built-in integrations use the same converter mechanism:

@Dao
@DaoReturnTypeConverters(PagingSourceDaoReturnTypeConverter::class)
interface MusicDao {
    @Query("SELECT * FROM Song")
    fun getSongsPaginated(): PagingSource<Int, Song>
}

You can write your own converter for any wrapper type. Here is a custom Promise converter for web targets:

object PromiseDaoReturnTypeConverter {
    @DaoReturnTypeConverter([OperationType.READ, OperationType.WRITE])
    fun <T> convert(
        db: RoomDatabase,
        executeAndConvert: suspend () -> T
    ): Promise<T> {
        return db.getCoroutineScope().promise { executeAndConvert() }
    }
}

This extensibility makes Room much more adaptable to different architectural patterns. If your project uses a custom Result wrapper or an Arrow Either, you can now teach Room to return those directly.

🆚 Room 3.0 vs SQLDelight: Where Do We Stand?

The elephant in the room. For years, SQLDelight was the only serious option for multiplatform database access in Kotlin. Now Room is a genuine competitor. How do they compare?

Room 3.0SQLDelight
ApproachKotlin-first (annotations)SQL-first (.sq files)
KMP TargetsAndroid, iOS, JVM, JS, WASMAndroid, iOS, JVM, JS, native
Learning CurveLower for Android devsLower for SQL-heavy devs
Jetpack IntegrationNative (Paging, LiveData, etc.)Requires adapters
Migration from Room 2.xNatural progressionFull rewrite
Maturity on KMPAlpha (newer)Stable (years of production use)

My take: if you are already on Room 2.x, migrating to 3.0 is the obvious choice. You keep your entities, your DAO structure, and your migration history. If you are starting a new KMP project from scratch and your team is comfortable writing raw SQL, SQLDelight remains excellent. But Room 3.0 has closed the gap significantly.

🗺️ Migration Strategy

Room 2.x is entering maintenance mode — bug fixes and dependency updates will continue until 3.0 stabilizes, but no new features.

The recommended migration path:

  1. Now: Migrate from KAPT to KSP if you have not already (works with Room 2.6+)
  2. Now: Start using SQLiteDriver APIs with Room 2.7+ to get familiar with the new patterns
  3. When stable: Update artifact coordinates from androidx.room to androidx.room3
  4. When stable: Replace runInTransaction → withWriteTransaction, query() → useReaderConnection, cursor-based code → statement-based code
  5. When stable: Make all DAO functions suspend
  6. When stable: Replace InvalidationTracker.Observer with createFlow()

If you have SupportSQLite usage that is hard to migrate immediately, room3-sqlite-wrapper provides a bridge:

// Temporary bridge during migration
val supportDb = roomDatabase.getSupportWrapper()

⚠️ Current Status

Room 3.0 is in alpha (3.0.0-alpha02 as of March 25, 2026). This means:

Do not wait for stable to start preparing. The KAPT → KSP and SupportSQLite → SQLiteDriver migrations can happen today on Room 2.x.

💡 Key Takeaways

📚 Further Reading