1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Room3.0 の概要

1
Posted at

Room 3.0 - Modernizing the Room まとめ

2026年3月に、AndroidのローカルDBライブラリ Room 3.0 alpha が公開されました。

上記記事の公式ブログ「Room 3.0 - Modernizing the Room」の内容をかいつまんで整理します。

Room 3.0の目的

Room 3.0のアップデート目的は以下でKotlin MultiplatformやWeb環境に対応しました。クロスプラットフォームDBライブラリとして進化しています。
Roomは3.0から以下のプラットフォームを対象にしています。

  • Android
  • iOS
  • JVM Desktop
  • JavaScript
  • WebAssembly

SupportSQLite APIの廃止

Room 3.0では SupportSQLite APIが廃止されました。この破壊的変更によりAndroid APIへの依存を削減してKotlin Multiplatformに対応しました。

従来

SupportSQLiteDatabase
SupportSQLiteOpenHelper

Room 3.0

SQLiteDriver
SQLiteConnection

Kotlinコード生成のみ

Room 3.0からJavaのコード生成が廃止されました。Kotlin用ライブラリになります。

KSPのみサポート

Room 3.0ではJava Annotation ProcessingとがKAPT廃止されました。代わりに
KSP (Kotlin Symbol Processing)のみ対応します。
KSPを使うことでKotlinコード高速化、ビルド速度改善が期待できます。

Coroutines前提のAPI

Room 3.0からCoroutinesが必須の設計になりました。DAO関数は基本的にsuspendが必須になり、ブロッキングなDAO関数は禁止されます。

@Query("SELECT * FROM user")
suspend fun getUsers(): List<User>

新しいパッケージ

Room 3.0は新しいパッケージになりました。既存ライブラリとの衝突依存を防ぎます。

androidx.room:room-runtime
↓
androidx.room3:room3-runtime

まとめ

Room 3.0の主な変更点です。Android専用DBライブラリからクロスプラットフォームDBに進化しました。

変更点 内容
Kotlin Multiplatform Android以外でも利用可能
SupportSQLite廃止 SQLiteDriverへ移行
Java生成廃止 Kotlinコード生成のみ
KSPのみ対応 KAPT / AnnotationProcessor廃止
Coroutines前提 DAOは非同期API必須
新パッケージ androidx.room3

参考

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?