اتاق

کتابخانه‌ی پایداری Room یک لایه‌ی انتزاعی روی SQLite فراهم می‌کند تا دسترسی به پایگاه داده را قوی‌تر کند و در عین حال از تمام قدرت SQLite بهره ببرد.
آخرین به‌روزرسانی انتشار پایدار کاندیدای انتشار انتشار بتا انتشار آلفا
۲۲ اکتبر ۲۰۲۵ ۲.۸.۳ - - -

اعلام وابستگی‌ها

برای افزودن وابستگی به Room، باید مخزن Google Maven را به پروژه خود اضافه کنید. برای اطلاعات بیشتر، مخزن Maven گوگل را مطالعه کنید.

وابستگی‌های Room شامل آزمایش مهاجرت‌های Room و Room RxJava می‌شود.

وابستگی‌های مربوط به مصنوعات مورد نیاز خود را در فایل build.gradle برای برنامه یا ماژول خود اضافه کنید:

کاتلین

dependencies {
    val room_version = "2.8.3"

    implementation("androidx.room:room-runtime:$room_version")

    // If this project uses any Kotlin source, use Kotlin Symbol Processing (KSP)
    // See Add the KSP plugin to your project
    ksp("androidx.room:room-compiler:$room_version")

    // If this project only uses Java source, use the Java annotationProcessor
    // No additional plugins are necessary
    annotationProcessor("androidx.room:room-compiler:$room_version")

    // optional - Kotlin Extensions and Coroutines support for Room
    implementation("androidx.room:room-ktx:$room_version")

    // optional - RxJava2 support for Room
    implementation("androidx.room:room-rxjava2:$room_version")

    // optional - RxJava3 support for Room
    implementation("androidx.room:room-rxjava3:$room_version")

    // optional - Guava support for Room, including Optional and ListenableFuture
    implementation("androidx.room:room-guava:$room_version")

    // optional - Test helpers
    testImplementation("androidx.room:room-testing:$room_version")

    // optional - Paging 3 Integration
    implementation("androidx.room:room-paging:$room_version")
}

شیار

dependencies {
    def room_version = "2.8.3"

    implementation "androidx.room:room-runtime:$room_version"

    // If this project uses any Kotlin source, use Kotlin Symbol Processing (KSP)
    // See KSP Quickstart to add KSP to your build
    ksp "androidx.room:room-compiler:$room_version"

    // If this project only uses Java source, use the Java annotationProcessor
    // No additional plugins are necessary
    annotationProcessor "androidx.room:room-compiler:$room_version"

    // optional - RxJava2 support for Room
    implementation "androidx.room:room-rxjava2:$room_version"

    // optional - RxJava3 support for Room
    implementation "androidx.room:room-rxjava3:$room_version"

    // optional - Guava support for Room, including Optional and ListenableFuture
    implementation "androidx.room:room-guava:$room_version"

    // optional - Test helpers
    testImplementation "androidx.room:room-testing:$room_version"

    // optional - Paging 3 Integration
    implementation "androidx.room:room-paging:$room_version"
}

برای اطلاعات بیشتر در مورد استفاده از افزونه KAPT، به مستندات KAPT مراجعه کنید.

برای اطلاعات بیشتر در مورد استفاده از افزونه KSP، به مستندات شروع سریع KSP مراجعه کنید.

برای اطلاعات بیشتر در مورد استفاده از افزونه‌های کاتلین، به مستندات ktx مراجعه کنید.

برای اطلاعات بیشتر در مورد وابستگی‌ها، به بخش «افزودن وابستگی‌های ساخت» مراجعه کنید.

به صورت اختیاری، برای کتابخانه‌های غیر اندروید (یعنی ماژول‌های Gradle فقط جاوا یا کاتلین) می‌توانید برای استفاده از حاشیه‌نویسی‌های Room به androidx.room:room-common وابسته باشید.

پیکربندی گزینه‌های کامپایلر

Room گزینه‌های پردازش حاشیه‌نویسی زیر را دارد.

room.schemaLocation directory
امکان خروجی گرفتن از طرحواره‌های پایگاه داده به فایل‌های JSON در دایرکتوری داده شده را فراهم می‌کند. برای اطلاعات بیشتر به Room Migrations مراجعه کنید.
room.incremental boolean
پردازنده حاشیه‌نویسی افزایشی Gradle را فعال می‌کند. مقدار پیش‌فرض true است.
room.generateKotlin boolean
به جای جاوا، فایل‌های سورس کاتلین تولید می‌کند. به KSP نیاز دارد. مقدار پیش‌فرض از نسخه ۲.۷.۰ به بعد true است. برای جزئیات بیشتر به یادداشت‌های نسخه ۲.۶.۰ ، زمانی که معرفی شد، مراجعه کنید.

از افزونه Room Gradle استفاده کنید

با نسخه ۲.۶.۰ و بالاتر از Room، می‌توانید از افزونه Room Gradle برای پیکربندی گزینه‌های کامپایلر Room استفاده کنید. این افزونه پروژه را طوری پیکربندی می‌کند که طرحواره‌های تولید شده (که خروجی وظایف کامپایل هستند و برای مهاجرت‌های خودکار استفاده می‌شوند) به درستی پیکربندی شوند تا دارای ساخت‌های قابل تکرار و قابل ذخیره باشند.

برای افزودن افزونه، در فایل ساخت سطح بالای Gradle خود، افزونه و نسخه آن را تعریف کنید.

گرووی

plugins {
    id 'androidx.room' version "$room_version" apply false
}

کاتلین

plugins {
    id("androidx.room") version "$room_version" apply false
}

در فایل ساخت Gradle در سطح ماژول، افزونه را اعمال کنید و از افزونه room استفاده کنید.

گرووی

plugins {
    id 'androidx.room'
}

android {
    ...
    room {
        schemaDirectory "$projectDir/schemas"
    }
}

کاتلین

plugins {
    id("androidx.room")
}

android {
    ...
    room {
        schemaDirectory("$projectDir/schemas")
    }
}

تنظیم schemaDirectory هنگام استفاده از افزونه Room Gradle الزامی است. این کار کامپایلر Room و وظایف مختلف کامپایل و backend های آن (javac، KAPT، KSP) را طوری پیکربندی می‌کند که فایل‌های schema را در پوشه‌های flavored، به عنوان مثال schemas/flavorOneDebug/com.package.MyDatabase/1.json خروجی دهد. این فایل‌ها باید در مخزن بررسی شوند تا برای اعتبارسنجی و مهاجرت خودکار استفاده شوند.

برخی از گزینه‌ها در تمام نسخه‌های افزونه Room Gradle قابل پیکربندی نیستند، حتی اگر توسط کامپایلر Room پشتیبانی شوند. جدول زیر هر گزینه را فهرست کرده و نسخه‌ای از افزونه Room Gradle را نشان می‌دهد که پشتیبانی از پیکربندی آن گزینه را با استفاده از افزونه room اضافه کرده است. اگر نسخه شما پایین‌تر است، یا اگر این گزینه هنوز پشتیبانی نمی‌شود، می‌توانید به جای آن از گزینه‌های پردازنده حاشیه‌نویسی استفاده کنید.

گزینه از زمان نسخه
room.schemaLocation (الزامی) ۲.۶.۰
room.incremental -
room.generateKotlin -

استفاده از گزینه‌های پردازشگر حاشیه‌نویسی

اگر از افزونه‌ی Gradle مربوط به Room استفاده نمی‌کنید، یا اگر گزینه‌ی مورد نظر شما توسط نسخه‌ی افزونه‌ی شما پشتیبانی نمی‌شود، می‌توانید Room را با استفاده از گزینه‌های پردازنده‌ی حاشیه‌نویسی، همانطور که در بخش «افزودن وابستگی‌های ساخت» توضیح داده شده است، پیکربندی کنید. نحوه‌ی تعیین گزینه‌های حاشیه‌نویسی بستگی به این دارد که آیا از KSP یا KAPT برای Room استفاده می‌کنید.

گرووی

// For KSP
ksp {
    arg("option_name", "option_value")
    // other otions...
}

// For javac and KAPT
android {
    ...
    defaultConfig {
        ...
        javaCompileOptions {
            annotationProcessorOptions {
                arguments += [
                    "option_name":"option_value",
                    // other options...
                    ]
            }
        }
    }
}

کاتلین

// For KSP
ksp {
    arg("option_name", "option_value")
    // other options...
}

// For javac and KAPT
android {
    ...
    defaultConfig {
        ...
        javaCompileOptions {
            annotationProcessorOptions {
                arguments += mapOf(
                    "option_name" to "option_value",
                    // other options...
                )
            }
        }
    }
}

از آنجا که room.schemaLocation یک دایرکتوری است و نه یک نوع اولیه، لازم است هنگام اضافه کردن این گزینه از CommandLineArgumentsProvider استفاده کنید تا Gradle هنگام انجام بررسی‌های به‌روز، از این دایرکتوری مطلع باشد. Migrate your Room database یک پیاده‌سازی کامل از CommandLineArgumentsProvider را نشان می‌دهد که مکان schema را فراهم می‌کند.

بازخورد

بازخورد شما به بهبود Jetpack کمک می‌کند. اگر مشکلات جدیدی کشف کردید یا ایده‌هایی برای بهبود این کتابخانه دارید، به ما اطلاع دهید. لطفاً قبل از ایجاد یک کتابخانه جدید، نگاهی به مشکلات موجود در این کتابخانه بیندازید. می‌توانید با کلیک بر روی دکمه ستاره، رأی خود را به یک مشکل موجود اضافه کنید.

ایجاد یک مسئله جدید

برای اطلاعات بیشتر به مستندات ردیاب مشکل مراجعه کنید.

نسخه ۲.۸

نسخه ۲.۸.۳

۲۲ اکتبر ۲۰۲۵

androidx.room:room-*:2.8.3 منتشر شد. نسخه 2.8.3 شامل این کامیت‌ها است.

رفع اشکالات

  • مشکل عملکرد با Room SQLite Wrapper که باعث فراخوانی‌های بیش از حد JNI و افت قابل توجه عملکرد هنگام تکرار روی یک Cursor می‌شد، برطرف شد.

نسخه ۲.۸.۲

۸ اکتبر ۲۰۲۵

androidx.room:room-*:2.8.2 منتشر شد. نسخه ۲.۸.۲ شامل این کامیت‌ها است.

رفع اشکالات

  • رفع بن‌بستی که ممکن است هنگام بازگشایی یک پایگاه داده خودکار بسته شده از انتشار جریان ( b/446643789 ) رخ دهد.

نسخه ۲.۸.۱

۲۴ سپتامبر ۲۰۲۵

androidx.room:room-*:2.8.1 منتشر شد. نسخه 2.8.1 شامل این کامیت‌ها است.

رفع اشکالات

  • رفع مشکل از کار افتادن پردازنده که هنگام پردازش یک تابع DAO با یک لامبدا به حالت تعلیق در می‌آمد. ( b/442220723 )
  • یک شرط رقابتی را که مانع از دریافت آخرین به‌روزرسانی‌ها توسط Flows می‌شد، برطرف کنید.

نسخه ۲.۸.۰

۱۰ سپتامبر ۲۰۲۵

androidx.room:room-*:2.8.0 منتشر شد. نسخه 2.8.0 شامل این کامیت‌ها است.

تغییرات مهم از زمان ۲.۷.۰:

  • یک مصنوع جدید androidx.room:room-sqlite-wrapper اضافه شده است که شامل APIهایی برای دریافت یک پوشش SupportSQLiteDatabase از یک RoomDatabase با SQLiteDriver پیکربندی شده است. برای دریافت این پوشش، از تابع افزونه جدید RoomDatabase.getSupportWrapper() استفاده کنید. این یک مصنوع سازگاری برای حفظ کاربردهای SupportSQLiteDatabase است که معمولاً از roomDatabase.openHelper.writableDatabase به دست می‌آید، حتی اگر پایگاه داده Room با SQLiteDriver پیکربندی شده باشد. این پوشش برای مهاجرت تدریجی پایگاه‌های کد که مایل به پذیرش APIهای SQLiteDriver هستند اما کاربردهای گسترده‌ای از APIهای SupportSQLite دارند اما می‌خواهند از BundledSQLiteDriver بهره ببرند، مفید است. برای اطلاعات بیشتر، راهنمای مهاجرت را بررسی کنید.
  • پشتیبانی از KMP برای سیستم‌عامل‌های Watch OS و Tv OS اضافه شد.
  • به‌روزرسانی minSDK اندروید کتابخانه از API 21 به API 23

نسخه ۲.۸.۰-rc02

۲۷ آگوست ۲۰۲۵

androidx.room:room-*:2.8.0-rc02 منتشر شد. نسخه 2.8.0-rc02 شامل این کامیت‌ها است.

تغییرات API

  • به‌روزرسانی minSDK از API 21 به API 23 ( Ibdfca ، b/380448311 ، b/435705964 ، b/435705223 )
  • حداقل نسخه افزونه اندروید گریدل (AGP) سازگار با افزونه Room Gradle را از ۸.۱ به ۸.۴ به‌روزرسانی کنید. ( Ia0d28 )

رفع اشکالات

  • مشکلی را برطرف کنید که در آن یک مهاجرت مخرب انجام می‌شد، حتی اگر مسیر مهاجرت برای یک پایگاه داده از پیش بسته‌بندی شده ( b/432634197 ) در دسترس بود.

نسخه ۲.۸.۰-rc01

۱۳ آگوست ۲۰۲۵

androidx.room:room-*:2.8.0-rc01 منتشر شد. نسخه 2.8.0-rc01 شامل این کامیت‌ها است.

تغییرات API

  • حذف حاشیه‌نویسی‌های منسوخ‌شده‌ی @RequiresApi(21) ( Ic4792 ، I9103b )

رفع اشکالات

  • رفع مشکل عدم نمایش آخرین نتیجه پرس‌وجو در شرایط چند پرس‌وجو/نوشتن ناهمزمان توسط Room Flows ( Ic9a3c )

نسخه ۲.۸.۰-بتا۰۱

۱ آگوست ۲۰۲۵

androidx.room:room-*:2.8.0-beta01 منتشر شد. نسخه 2.8.0-beta01 شامل این کامیت‌ها است.

رفع اشکالات

  • نام‌های جدول و نما اکنون در طول مهاجرت‌های مخرب به درستی escape می‌شوند. ( 9e55f8 ، b/427095319 )

نسخه ۲.۸.۰-آلفا۰۱

۱۶ ژوئیه ۲۰۲۵

androidx.room:room-*:2.8.0-alpha01 منتشر شد. نسخه 2.8.0-alpha01 شامل این کامیت‌ها است.

ویژگی‌های جدید

  • یک مصنوع جدید androidx.room:room-sqlite-wrapper اضافه شده است که شامل APIهایی برای دریافت یک پوشش SupportSQLiteDatabase از RoomDatabase با یک SQLiteDriver پیکربندی شده است. برای دریافت این پوشش، از تابع افزونه جدید RoomDatabase.getSupportWrapper() استفاده کنید. این یک مصنوع سازگاری برای حفظ کاربردهای SupportSQLiteDatabase است که معمولاً از RoomDatabase.openHelper.writableDatabase به دست می‌آید، حتی اگر پایگاه داده Room با SQLiteDriver پیکربندی شده باشد. این پوشش برای مهاجرت تدریجی پایگاه‌های کد که مایل به پذیرش SQLiteDriver هستند اما کاربردهای گسترده‌ای از APIهای SupportSQLite دارند اما می‌خواهند از BundledSQLiteDriver بهره ببرند، مفید است. ( Icf6ac )
  • اضافه کردن اهداف KMP برای Watch OS و TV OS ( I228f6 ، b/394238801 )

رفع اشکالات

  • رفع مشکل بن‌بستی که گاهی اوقات هنگام استفاده از تراکنش‌های معلق و AndroidSQLiteDriver رخ می‌دهد. ( b/415006268 )

نسخه ۲.۷

نسخه ۲.۷.۲

۱۸ ژوئن ۲۰۲۵

androidx.room:room-*:2.7.2 منتشر شد. نسخه 2.7.2 شامل این کامیت‌ها است.

رفع اشکالات

  • مشکلی را برطرف کنید که در آن مقادیر حاشیه‌نویسی هنگام پردازش منابع بومی با KSP به اشتباه خوانده می‌شدند و گاهی اوقات خروجی‌های طرحواره از دست می‌رفتند. ( b/416549580 )
  • رفع اشکالی که در آن، مقدم کردن نظرات در یک SQL باعث می‌شد دستورات طوری اجرا شوند که انگار کوئری‌های خوانده نشده هستند. ( b/413061402 )
  • رفع مشکل عدم پیکربندی افزونه Gradle در Room به دلیل خالی بودن دایرکتوری schema. ( b/417823384 )
  • دیگر وقتی دریافت اتصال خیلی طول می‌کشد، SQLiteException ارسال نمی‌شود، در عوض یک پیام لاگ توسط کتابخانه ارسال می‌شود. لاگ کردن به جای throw کردن، مشکل تعلیق حلقه‌های iOS را حل می‌کند و باعث می‌شود Room زمان انقضایی را که در Kotlin Coroutine هنگام دریافت اتصال رخ می‌دهد، اشتباه تفسیر کند و در نتیجه از ارسال استثنا هنگام خاموش شدن برنامه iOS در پس‌زمینه و از سرگیری مجدد آن در وسط عملیات پایگاه داده جلوگیری می‌کند. ( b/422448815 )

نسخه ۲.۷.۱

۲۳ آوریل ۲۰۲۵

androidx.room:room-*:2.7.1 منتشر شد. نسخه 2.7.1 شامل این کامیت‌ها است.

رفع اشکالات

  • رفع اشکال IndexOutOfBoundsException در طول اعتبارسنجی مبدل نوع ارائه شده. ( b/409804755 ).
  • پشتیبانی از RoomDatabase.runInTransaction() هنگامی که یک SQLiteDriver با Room پیکربندی شده است. ( b/408364828 ).

نسخه ۲.۷.۰

۹ آوریل ۲۰۲۵

androidx.room:room-*:2.7.0 منتشر شد. نسخه 2.7.0 شامل این کامیت‌ها است.

تغییرات مهم از زمان ۲.۶.۰

  • پشتیبانی از چندسکویی کاتلین (KMP): در این نسخه، Room برای تبدیل شدن به یک کتابخانه چندسکویی کاتلین (KMP) بازسازی شده است. پلتفرم‌های پشتیبانی‌شده فعلی عبارتند از اندروید، iOS، JVM (دسکتاپ)، مک بومی و لینوکس بومی. برای اطلاعات بیشتر در مورد نحوه شروع استفاده از Room KMP، لطفاً به مستندات رسمی Room KMP مراجعه کنید. به عنوان بخشی از پشتیبانی KMP، Room همچنین می‌تواند با SQLiteDriver پیکربندی شود، برای اطلاعات در مورد نحوه مهاجرت یک برنامه موجود به APIهای درایور و به Room KMP، به مستندات مهاجرت مراجعه کنید.
  • اگر پردازش از طریق KSP انجام شود، تولید کد کاتلین در KSP به طور پیش‌فرض فعال است. برای پروژه‌های KAPT یا فقط جاوا، Room همچنان منابع جاوا را تولید خواهد کرد.
  • کاتلین ۲.۰ و KSP2: اکنون Room زبان کاتلین ۲.۰ را هدف قرار می‌دهد و پروژه‌ها را ملزم به کامپایل با کاتلین ۲.۰ و نسخه زبانی معادل یا بالاتر نیز خواهد کرد. پشتیبانی از KSP2 نیز اضافه شده است و هنگام استفاده از Room با کاتلین ۲.۰ یا بالاتر توصیه می‌شود.

نسخه ۲.۷.۰-rc03

۲۶ مارس ۲۰۲۵

androidx.room:room-*:2.7.0-rc03 منتشر شد. نسخه 2.7.0-rc03 شامل این کامیت‌ها است.

رفع اشکالات

  • دیگر هنگام قطع شدن یک رشته در حین اجرای APIهای مسدودکننده Room، از جمله توابع مسدودکننده DAO ( b/400584611 )، خطای InterruptedException صادر نمی‌شود.
  • پیاده‌سازی مجدد مجموعه اتصالات Room برای کاهش خطای SQLException: Error code: 5, message: Timed out attempting to acquire a reader connection. و مشکلات مشابه ( b/380088809 ).

نسخه ۲.۷.۰-rc02

۱۲ مارس ۲۰۲۵

androidx.room:room-*:2.7.0-rc02 منتشر شد. نسخه 2.7.0-rc02 شامل این کامیت‌ها است.

رفع اشکالات

  • رفع مشکل مدیریت نادرست ستون جدید در جدول FTS توسط مهاجرت‌های خودکار ( b/348227770 ، Ic53f3 )
  • رفع مشکل از کار افتادن کامپایلر room به دلیل NullPointerException هنگام پردازش منابع غیر JVM از طریق KSP. ( b/396607230 , I693c9 )
  • مشکلی که باعث می‌شد Room در پایان استفاده از اتصال نویسنده، جداول را نامعتبر نکند، برطرف شد. ( b/340606803 , I73ef6 )

نسخه ۲.۷.۰-rc01

۲۶ فوریه ۲۰۲۵

androidx.room:room-*:2.7.0-rc01 منتشر شد. نسخه 2.7.0-rc01 شامل این کامیت‌ها است.

رفع اشکالات

  • مشکلی را برطرف کنید که در آن Room در اتصال اولیه به پایگاه داده، busy_timeout را تنظیم نمی‌کرد و منجر به SQLException: Error code: 5, message: database is locked ( I93208 , b/380088809 ) می‌شد.
  • مشکلی در کامپایلر Room که باعث می‌شد پردازنده KSP هنگام پردازش مجموعه‌های منبع بومی (مانند iOS) در Kotlin 2.1.x و KSP1 ( I883b8 ، b/396607230 ) از کار بیفتد، برطرف شد.

نسخه ۲.۷.۰-بتا۰۱

۱۲ فوریه ۲۰۲۵

androidx.room:room-*:2.7.0-beta01 منتشر شد. نسخه 2.7.0-beta01 شامل این کامیت‌ها است.

رفع اشکالات

  • مشکلی را که با RoomDatabase.inTransaction() ایجاد می‌شد و یک پایگاه داده بسته را باز می‌کرد، در حالی که نباید این کار را می‌کرد و اگر پایگاه داده بسته باشد، باید به سرعت مقدار false را برگرداند، برطرف کرد ( b/325432967 ).
  • رفع مشکل از کار افتادن ( IllegalArgumentException: not a valid name ) در کامپایلر Room هنگام پردازش توابع DAO با کلاس‌های درون‌خطی/مقداری کاتلین ( b/388299754 ).
  • قوانین Proguard را در مصنوع JVM مربوط به room-runtime بگنجانید تا سازنده پیش‌فرض پیاده‌سازی پایگاه داده تولید شده حذف نشود، زیرا توسط مقداردهی اولیه پیش‌فرض Room که از reflection ( b/392657750 ) استفاده می‌کند، استفاده می‌شود.

نسخه ۲.۷.۰-آلفا۱۳

۲۹ ژانویه ۲۰۲۵

androidx.room:room-*:2.7.0-alpha13 منتشر شد. نسخه 2.7.0-alpha13 شامل این کامیت‌ها است.

تغییرات API

  • اکنون Room زبان کاتلین ۲.۰ را هدف قرار می‌دهد و از پروژه‌ها خواهد خواست که با کاتلین ۲.۰ و نسخه معادل یا زبان سطح بالا نیز کامپایل شوند. ( I8efb0 ، b/315461431 ، b/384600605 )

رفع اشکالات

  • رفع مشکلی در سازنده پایگاه داده Room KMP که در اندروید از یک نام ساده به جای مسیر استفاده می‌شد و مسیر فایل پایگاه داده در دایرکتوری داده‌های برنامه قرار نمی‌گرفت. ( I83315 ، b/377830104 )
  • مشکلی را با افزونه Room Gradle برطرف کردیم که در آن پیکربندی ورودی‌ها و خروجی‌های طرحواره باعث ایجاد مشکل در پروژه‌های اندروید می‌شد: property 'inputDirectory' is final and cannot be changed any further. ( 1dbb4c ، b/376071291 )
  • اضافه شدن پشتیبانی برای KSP2 در افزونه Room Gradle که مشکلی را که در آن دایرکتوری schema به درستی توسط افزونه تنظیم نمی‌شد، برطرف می‌کند. ( Iec3c4 ، b/379159770 )

مشارکت خارجی

  • مشکلی را در ادغام صفحه‌بندی Room که باعث پرش رابط کاربری می‌شد، زمانی که کلید اولیه برای به‌روزرسانی خیلی نزدیک به انتهای لیست بود، برطرف کنید. با تشکر از Eva! ( I2abbe ، b/389729367 )

نسخه ۲.۷.۰-آلفا۱۲

۱۱ دسامبر ۲۰۲۴

androidx.room:room-*:2.7.0-alpha12 منتشر شد. نسخه 2.7.0-alpha12 شامل این کامیت‌ها است.

تغییرات API

  • برای پیکربندی اینکه آیا Room از یک جدول درون حافظه‌ای برای ردیابی نامعتبرسازی استفاده کند یا خیر، API آزمایشی RoomDatabase.Builder.setInMemoryTrackingMode() را اضافه کنید. ( I2a9b2 , b/185414040 )

رفع اشکالات

  • مهاجرت‌های مخرب اکنون نماها را حذف می‌کنند تا از ایجاد مجدد آنها اطمینان حاصل شود و رفتار را هنگامی که allowDestructiveMigrationForAllTables روشن است (پیش‌فرض KMP) با رفتار موجود هنگام خاموش بودن آن هم‌تراز می‌کنند. ( 0a3e83 ، b/381518941 )

نسخه ۲.۷.۰-آلفا۱۱

۳۰ اکتبر ۲۰۲۴

androidx.room:room-*:2.7.0-alpha11 منتشر شد. نسخه 2.7.0-alpha11 شامل این کامیت‌ها است.

تغییرات API

  • امضای متد convertRows() که به تازگی اضافه شده است را دوباره بررسی کنید تا یک تابع suspend باشد که یک RawRoomQuery برای صفحه‌بندی اتاق دریافت می‌کند. ( Ie57b5 ، b/369136627 )

رفع اشکالات

  • مشکل صفحه‌بندی اتاق که در آن هنگام استفاده از @Relation همراه با PagingSource کد نامعتبر تولید می‌شد، برطرف شد.

نسخه ۲.۷.۰-آلفا۱۰

۱۶ اکتبر ۲۰۲۴

androidx.room:room-*:2.7.0-alpha10 منتشر شد. نسخه 2.7.0-alpha10 شامل این کامیت‌ها است.

تغییرات API

  • یک کلاس داخلی ByteArrayWrapper برای پشتیبانی از روابط با ByteBuffer در پلتفرم‌های غیر اندروید و غیر JVM ایجاد کنید. ( I75543 ، b/367205685 )
  • برای فعال کردن بازیابی نوع داده یک ستون، SQLiteStatement.getColumnType() به همراه ثابت‌های مختلف نتیجه SQLITE_DATA_* اضافه کنید. ( I1985c ، b/369636251 )

نسخه ۲.۷.۰-alpha09

۲ اکتبر ۲۰۲۴

androidx.room:room-*:2.7.0-alpha09 منتشر شد. نسخه 2.7.0-alpha09 شامل این کامیت‌ها است.

رفع اشکالات

  • مشکلی را در پیاده‌سازی KMP از room-paging که باعث ایجاد Error code: 8, message: attempt to write a readonly database به دلیل شروع یک تراکنش نوشتن روی یک اتصال خواندن می‌شد، برطرف کردیم. ( b/368380988 )

نسخه ۲.۷.۰-آلفا۰۸

۱۸ سپتامبر ۲۰۲۴

androidx.room:room-*:2.7.0-alpha08 منتشر شد. نسخه 2.7.0-alpha08 شامل این کامیت‌ها است.

ویژگی‌های جدید

  • مصنوعات room-paging برای سازگاری با KMP منتقل شده‌اند. ( Ib8756 ، b/339934824 )
  • API invalidationTrackerFlow() به عنوان یک API شخص ثالث با نام InvalidationTracker.createFlow() رایج شده است و اکنون برای مجموعه‌های منبع غیر اندرویدی در پروژه‌های KMP در دسترس است. ( I1fbfa , ( I8fb29 ), b/329291639 , b/329315924 )

تغییرات API

  • تمام هشدارها و پیام‌های خطا در Room که از کلمه Cursor استفاده می‌کردند، حذف یا جایگزین شده‌اند، زیرا Cursor دیگر یک اصطلاح عمومی دقیق برای استفاده در نسخه KMP Room نیست. ( Id8cd9 ، b/334087492 )

رفع اشکالات

  • مشکلی که باعث می‌شد Room KMP سعی کند کدی را با استفاده از UUID برای پلتفرم‌های غیر JVM منتشر کند، برطرف شد. ( b/362994709 )
  • مشکلی با افزونه Room Gradle که هنگام استفاده در یک پروژه KMP با Compose Multiplatform باعث خطایی مانند «نمی‌توان ویژگی‌های پیکربندی را تغییر داد ... پس از قفل شدن برای جهش» می‌شد، برطرف شد. ( b/343408758 )

نسخه ۲.۷.۰-alpha07

۲۱ آگوست ۲۰۲۴

androidx.room:room-*:2.7.0-alpha07 منتشر شد. نسخه 2.7.0-alpha07 شامل این کامیت‌ها است.

ویژگی‌های جدید

  • افزونه Room Gradle اکنون به طور خودکار طرحواره‌های صادر شده را به منابع منبع Android Instrumentation Test اضافه می‌کند تا MigrationTestHelper بتواند از آنها استفاده کند.

رفع اشکالات

  • مشکلی که باعث می‌شد تابع 'actual' تولید شده از RoomDatabaseConstructor فاقد اصلاحگر 'actual' در تابع initialize باشد، در صورتی که چنین تابعی در تعریف 'expect' نیز بازنویسی شده باشد، برطرف شد. ( 359631627 )
  • مشکلی که باعث می‌شد مقدار «actual» تولید شده در RoomDatabaseConstructor با مقدار قابل مشاهده‌ی اعلان «expect» مطابقت نداشته باشد، برطرف شد. ( 358138953 )

نسخه ۲.۷.۰-alpha06

۷ آگوست ۲۰۲۴

androidx.room:room-*:2.7.0-alpha06 منتشر شد. نسخه 2.7.0-alpha06 شامل این کامیت‌ها است.

تغییرات API

  • تنظیمات نمونه‌سازی برای RoomDatabase را در یک پروژه KMP تغییر دهید.

با توجه به مدل کامپایل کاتلین ۲.۰، استراتژی ارجاع به یک تابع تولید شده به نام instantiateImpl() دیگر قابل اجرا نیست. دو API جدید، @ConstructedBy و RoomDatabaseConstructor معرفی شده‌اند که جایگزین استراتژی instantiateImpl() می‌شوند. استراتژی جدید به شرح زیر است:

  1. یک شیء expect تعریف کنید که RoomDatabaseConstructor را پیاده‌سازی کند.

      expect object MyDatabaseCtor : RoomDatabaseConstructor<MyDatabase>
    
  2. با استفاده از @ConstructedBy شیء را به اعلان @Database پیوند دهید.

      @Database(...)
      @ConstructedBy(MyDatabaseCtor::class) // NEW
      abstract class MyDatabase : RoomDatabase
    
  3. یک نمونه پایگاه داده جدید ایجاد کنید اما بدون ارسال آرگومان factory

      fun createNewDatabase(path: String) =
        Room.databaseBuilder<AppDatabase>(name = path)
          .setDriver(BundledSQLiteDriver())
          .setQueryCoroutineContext(Dispatchers.IO)
          .build()
    

رفع مشکلات b/316978491 ، b/338446862 و b/342905180

  • پشتیبانی از @RawQuery در Room KMP با اضافه کردن یک API جدید به نام RoomRawQuery که از نظر نگهداری رشته خام SQL و تابعی برای اتصال آرگومان‌ها به یک دستور، مشابه SupportSQLiteQuery است. توابع حاشیه‌نویسی شده @RawQuery اکنون می‌توانند یک RoomRawQuery به عنوان پارامتر واحد خود بپذیرند. ( Iea844 , b/330586815 )
  • یک سربارگذاری از setQueryCallback() اضافه کنید که یک CoroutineContext بپذیرد. ( Id66ff ، b/309996304 )
  • پشتیبانی از اهداف چند پلتفرمی linuxArm64 Kotlin ( I139d3 ، b/338268719 ) اضافه شد.

رفع اشکالات

  • مشکلی را برطرف کنید که در آن Room به اشتباه فراخوانی recursiveFetchArrayMap را در اهداف غیر اندرویدی ایجاد می‌کرد. ( 710c36 ، b/352482325 )
  • مشکلی را برطرف کنید که گاهی اوقات Room در یک پروژه KMP، استثنائی در مورد «زمان تلاش برای اتصال به پایان رسیده است» ایجاد می‌کرد. ( fa72d0 ، b/347737870 )
  • مشکلی در مهاجرت‌های خودکار که کلیدهای خارجی را خیلی زودتر از زمانی که جداول دیگر طرح‌های خود را برای مطابقت با کلیدهای خارجی جدید تغییر دهند، بررسی می‌کرد، برطرف شد. ( 7672c0 ، b/352085724 )

نسخه ۲.۷.۰-آلفا۰۵

۱۰ ژوئیه ۲۰۲۴

androidx.room:room-*:2.7.0-alpha05 منتشر شد. نسخه 2.7.0-alpha05 شامل این کامیت‌ها است.

تغییرات API

  • SQLiteKt به SQLite و BundledSQLiteKt به BundledSQLite تغییر نام داد. ( I8b501 )

رفع اشکالات

  • اشکالی که باعث می‌شد RoomDatabase هنگام استفاده از AndroidSQLiteDriver دچار بن‌بست شود یا با خطای زمان اتصال مواجه شود، برطرف شد.

نسخه ۲.۷.۰-آلفا۰۴

۱۲ ژوئن ۲۰۲۴

androidx.room:room-*:2.7.0-alpha04 منتشر شد. نسخه 2.7.0-alpha04 شامل این کامیت‌ها است.

رفع اشکالات

  • مشکلی که در پردازنده حاشیه‌نویسی Room وجود داشت و باعث می‌شد هنگام تعریف نوع بازگشتی چند نگاشتی در یک DAO، کد KMP ناسازگار تولید شود، برطرف شد. ( b/340983093 )
  • مشکلی که باعث می‌شد Room در صورت عدم وجود بسته برای کلاس @Database ، نتواند پیاده‌سازی پایگاه داده تولید شده را پیدا کند، برطرف شد ( b/342097292 )
  • مشکلی که باعث می‌شد فعال کردن قابلیت بستن خودکار و نامعتبرسازی چند نمونه‌ای، گاهی اوقات باعث ایجاد خطای ConcurrentModificationException در زمان بسته شدن خودکار پایگاه داده به دلیل غیرفعال بودن آن شود، برطرف شد.

نسخه ۲.۷.۰-آلفا۰۳

۲۹ مه ۲۰۲۴

androidx.room:room-*:2.7.0-alpha03 منتشر شد. نسخه 2.7.0-alpha03 شامل این کامیت‌ها است.

رفع اشکالات

  • رفع مشکلات مختلف مربوط به Kotlin 2.0 و KSP 2.0. توجه داشته باشید که Kotlin 2.0 با پشتیبانی KSP 2 کامل نیست و تیم در حال کار بر روی API های مختلف و تغییرات رفتاری در کامپایلر جدید است. ( b/314151707 )

نسخه ۲.۷.۰-آلفا۰۲

۱۴ مه ۲۰۲۴

androidx.room:room-*:2.7.0-alpha02 منتشر شد. نسخه 2.7.0-alpha02 شامل این کامیت‌ها است.

رفع اشکالات

  • مشکلات مختلف KSP برطرف شد.

نسخه ۲.۷.۰-آلفا۰۱

۱ مه ۲۰۲۴

androidx.room:room-*:2.7.0-alpha01 منتشر شد. نسخه 2.7.0-alpha01 شامل این کامیت‌ها است.

ویژگی‌های جدید

  • پشتیبانی از چندسکویی کاتلین (KMP) : در این نسخه، Room برای تبدیل شدن به یک کتابخانه چندسکویی کاتلین (KMP) بازسازی شده است. اگرچه هنوز کارهایی برای انجام دادن وجود دارد، اما این نسخه نسخه جدیدی از Room را معرفی می‌کند که در آن اکثر قابلیت‌ها "مشترک" شده‌اند (برای چندسکویی ساخته شده‌اند). پلتفرم‌های پشتیبانی‌شده فعلی عبارتند از اندروید، iOS، JVM (دسکتاپ)، مک بومی و لینوکس بومی. هرگونه قابلیت از دست رفته در پلتفرم‌های پشتیبانی‌شده جدید، در نسخه‌های آینده Room "کاملاً تکمیل‌شده" خواهد بود.

برای اطلاعات بیشتر در مورد نحوه شروع به کار با Room KMP، لطفاً به مستندات رسمی Room KMP مراجعه کنید.

  • اگر پردازش از طریق KSP انجام شود، تولید کد کاتلین در KSP به طور پیش‌فرض فعال است. برای پروژه‌های KAPT یا فقط جاوا، Room همچنان منابع جاوا را تولید خواهد کرد.

تغییرات API

  • یک سربارگذاری از Room.databaseBuilder() اضافه شده است که یک پارامتر لامبدا می‌گیرد که قرار است با یک تابع تولید شده توسط Room استفاده شود تا از استفاده از بازتاب هنگام نمونه‌سازی پیاده‌سازی تولید شده RoomDatabase جلوگیری شود. مثال استفاده به شرح زیر است:
Room.databaseBuilder<MyDatabase>(
    context = appContext,
    name = dbFilePath,
    factory =  { MyDatabase::class.instantiateImpl() }
)
  • یک API برای پیکربندی یک Room با CoroutineContext به سازنده اضافه شده است: RoomDatabase.Builder.setQueryCoroutineContext . توجه داشته باشید که یک RoomDatabase فقط می‌تواند با اجراکننده‌هایی که از setQueryExecutor استفاده می‌کنند یا با یک Coroutine context پیکربندی شود، اما نه هر دو.
  • یک API برای پیکربندی Room با یک درایور SQLite اضافه شده است: RoomDatabase.Builder.setDriver() . برای اطلاعات بیشتر در مورد API درایور SQLite به مستندات SQLite KMP مراجعه کنید.
  • رابط‌های برنامه‌نویسی کاربردی (API) برای دسترسی به SQLiteConnection زیربنایی از رابط‌های برنامه‌نویسی کاربردی درایور اضافه شده‌اند: RoomDatabase.useReaderConnection و RoomDatabase.useWriterConnection .
  • فراخوانی‌های مربوط به Room در Varios اکنون نسخه‌ای بارگذاری‌شده دارند که به جای SupportSQLiteDatabase SQLiteConnection دریافت می‌کنند. این فراخوانی‌ها برای لغو شدن هنگام مهاجرت به یک پروژه KMP در نظر گرفته شده‌اند. برای اطلاعات بیشتر در مورد مهاجرت کاربردهای Room در یک برنامه اندروید به یک ماژول KMP مشترک، به راهنمای مهاجرت مراجعه کنید. فراخوانی‌های زیر عبارتند از:
    • Migration.migrate(SQLiteConnection)
    • AutoMigrationSpec.onPostMigrate(SQLiteConnection)
    • RoomDatabase.Callback.onCreate(SQLiteConnection)
    • RoomDatabase.Callback.onDestructiveMigration(SQLiteConnection)
    • RoomDatabase.Callback.onOpen(SQLiteConnection)
  • آرتیفکت KTX به نام androidx.room:room-ktx به همراه تمام API های آن به androidx.room:room-runtime ادغام شده است، این آرتیفکت اکنون خالی است. لطفاً آن را از لیست وابستگی‌های خود حذف کنید.

نسخه ۲.۶

نسخه ۲.۶.۱

۲۹ نوامبر ۲۰۲۳

androidx.room:room-*:2.6.1 منتشر شد. نسخه 2.6.1 شامل این کامیت‌ها است.

رفع اشکالات

  • مشکل کد تولید شده که در آن مقدار پیش‌فرض برای ستون‌های Double در EntityCursorConverter به جای 0.0 روی 0 تنظیم می‌شد، برطرف شد. یک راه حل بالقوه برای حالت لبه‌ای مشابه برای ستون‌های نوع Float نیز گنجانده شده است. ( Id75f5 ، b/304584179 )
  • استثنائاتی که از بارگذاری‌های PagingSource ایجاد می‌شوند، اکنون به عنوان یک LoadStateUpdate از LoadResult.Error حاوی Throwable منتشر می‌شوند. این حالت خطا از طریق PagingDataAdapter.loadStateFlow(Views) یا LazyPagingItems.loadState(Compose) قابل مشاهده است. توجه داشته باشید که این یک تغییر رفتاری است که در گذشته خطاهای بارگذاری به عنوان یک Exception توسط متد dao که بارگذاری را آغاز می‌کرد، نمایش داده می‌شدند. ( I93887 ، b/302708983 )

نسخه ۲.۶.۰

۱۸ اکتبر ۲۰۲۳

androidx.room:room-*:2.6.0 منتشر شد. نسخه 2.6.0 شامل این کامیت‌ها است.

تغییرات مهم از زمان ۲.۵.۰

  • گزینه فعال‌سازی تولید کد کاتلین (یا «Kotlin CodeGen») اکنون در Room KSP ( 4297ec0 ) موجود است. برای فعال کردن Kotlin CodeGen در Room، نام گزینه room.generateKotlin را به گزینه‌های پردازنده خود برای KSP اضافه کنید. برای جزئیات بیشتر در مورد نحوه ارسال گزینه‌های پردازنده برای KSP، به مستندات KSP مراجعه کنید.

نکته: هنگام استفاده از Kotlin CodeGen، توجه به این نکته ضروری است که محدودیت‌های دیگری نیز اضافه شده است. ویژگی‌های انتزاعی به عنوان دریافت‌کننده‌های DAO یا کوئری‌های DAO در Kotlin CodeGen مجاز نیستند و در عوض انتظار می‌رود که به صورت توابع بازنویسی شوند تا از این تصور غلط که مقدار ویژگی تغییرناپذیر است و نتیجه ذخیره شده ثابتی دارد، جلوگیری شود. محدودیت دیگری که اضافه شده است این است که انواع بازگشتی مجموعه Nullable دیگر در Room for Kotlin CodeGen مجاز نیستند.

هشدار: ممکن است متوجه شوید که پروژه‌های شما هنگام استفاده از Kotlin CodeGen از نظر nullability (تهی‌پذیری) سخت‌گیرانه‌تر هستند. در Kotlin CodeGen، تهی‌پذیری آرگومان‌های نوع مهم است، در حالی که در جاوا این موضوع عمدتاً نادیده گرفته می‌شود. برای مثال، فرض کنید شما یک «جریان» (Flow) دارید. نوع را برگردان و جدول خالی است. در Java CodeGen، این مشکلی ایجاد نمی‌کند، اما در Kotlin CodeGen، با خطا مواجه خواهید شد. برای جلوگیری از این، باید از `Flow` استفاده کنید. با فرض اینکه مقدار null منتشر شده باشد.

  • مصنوع جدید برای افزونه Gradle مربوط به Room با شناسه androidx.room به Room اضافه شده است که مشکلات مختلف موجود در Room در مورد داشتن ورودی‌ها و خروجی‌های طرحواره‌ها از طریق گزینه‌های پردازنده حاشیه‌نویسی Gradle را حل می‌کند. برای جزئیات بیشتر، به یادداشت‌های انتشار Room نسخه 2.6.0-alpha02 مراجعه کنید.
  • کلاس‌های مقداری در موجودیت‌های اتاق اکنون برای KSP پشتیبانی می‌شوند. ( 4194095 )
  • انواع بازگشتی نقشه تو در تو در توابع DAO اکنون در Room پشتیبانی می‌شوند. ( I13f48 , 203008711 )

نسخه ۲.۶.۰-rc01

۲۰ سپتامبر ۲۰۲۳

androidx.room:room-*:2.6.0-rc01 منتشر شد. نسخه 2.6.0-rc01 شامل این کامیت‌ها است.

نسخه ۲.۶.۰-بتا۰۱

۲۳ آگوست ۲۰۲۳

androidx.room:room-*:2.6.0-beta01 منتشر شد. نسخه 2.6.0-beta01 شامل این کامیت‌ها است.

رفع اشکالات

  • مدیریت استثنای SQLite در حالت خاص هنگام upsert که در آن استثنای 2067 SQLITE_CONSTRAINT_UNIQUE در طول upsert رخ می‌دهد، upsert باید یک به‌روزرسانی انجام دهد. ( If2849 , b/243039555 )

نسخه ۲.۶.۰-آلفا۰۳

۹ آگوست ۲۰۲۳

androidx.room:room-*:2.6.0-alpha03 منتشر شد. نسخه 2.6.0-alpha03 شامل این کامیت‌ها است.

ویژگی‌های جدید

  • انواع بازگشتی نقشه تو در تو در توابع DAO اکنون در Room پشتیبانی می‌شوند. ( I13f48 , 203008711 )

تغییرات API

  • یک حاشیه‌نویسی نوع جدید به نام @MapColumn ایجاد شده است تا جایگزین @MapInfo شود که اکنون منسوخ شده است. برای هر نام ستون ( keyColumnName ، valueColumnName یا هر دو) که در حاشیه‌نویسی @MapInfo ارائه شده است، باید یک حاشیه‌نویسی @MapColumn فقط با columnName تعریف کنید و از این حاشیه‌نویسی روی آرگومان نوع خاصی که در نوع بازگشتی تابع DAO به آن ارجاع داده می‌شود (کلید یا مقدار Map) استفاده کنید. دلیل این امر این است که حاشیه‌نویسی @MapColumn مستقیماً روی آرگومان نوع در نوع بازگشتی تابع DAO استفاده می‌شود، نه روی خود تابع مانند @MapInfo . برای اطلاعات بیشتر، لطفاً به مستندات @MapColumn مراجعه کنید. ( Ib0305 ، b/203008711 )
  • فایل‌های API به‌روزرسانی شدند تا حاشیه‌نویسی مربوط به سرکوب سازگاری ( I8e87a ، b/287516207 ) انجام شود.
  • رابط‌های برنامه‌نویسی (API) افزونه‌ی Room Gradle به‌روزرسانی شده‌اند تا همیشه نیازی به پیکربندی‌های جداگانه برای هر نوع داده نداشته باشند. این بدان معناست که این افزونه می‌تواند بدون ایجاد چندین دایرکتوری، یک مکان سراسری را برای همه نوع داده بپذیرد و مهاجرت‌های روان‌تری را امکان‌پذیر کند، اما در عین حال به اندازه کافی انعطاف‌پذیر است تا بتواند به صورت دستی طعم‌ها (flavors) یا طرحواره‌های نوع داده (type schemas) را پیکربندی کند و در عین حال مزایای افزونه (ساخت‌های قابل تکرار و قابل ذخیره در حافظه پنهان) را حفظ کند. ( I09d6f ، b/278266663 )

رفع اشکالات

  • آسیب‌پذیری نشت حافظه احتمالی در QueryInterceptorStatement برطرف شد. ( I193d1 )
  • رفتار نادرست در تابع QueryInterceptorDatabase execSQL() برطرف شد. ( Iefdc8 )

نسخه ۲.۶.۰-آلفا۰۲

۲۱ ژوئن ۲۰۲۳

androidx.room:room-*:2.6.0-alpha02 منتشر شد. نسخه 2.6.0-alpha02 شامل این کامیت‌ها است.

افزونه‌ی Gradle اتاق

این نسخه جدید شامل یک مصنوع جدید برای افزونه Room Gradle با شناسه androidx.room است که مشکلات مختلف موجود در Room در مورد داشتن ورودی‌ها و خروجی‌های طرحواره‌ها از طریق گزینه‌های پردازنده حاشیه‌نویسی Gradle را حل می‌کند. افزونه Room Gradle پروژه را طوری پیکربندی می‌کند که طرحواره‌های تولید شده که برای مهاجرت‌های خودکار استفاده می‌شوند و خروجی وظایف کامپایل هستند، به درستی پیکربندی شوند تا دارای ساخت‌های قابل تکرار و قابل ذخیره باشند. این افزونه یک DSL برای پیکربندی مکان طرحواره پایه ارائه می‌دهد:

room {
    schemaDirectory("$projectDir/schemas/")
}

سپس افزونه، کامپایلر Room و وظایف کامپایل مختلف و backend های آن (javac، KAPT، KSP) را طوری پیکربندی می‌کند که فایل‌های طرحواره را در پوشه‌های flavored، یعنی schemas/flavorOneDebug/com.package.MyDatabase/1.json خروجی دهد. طبق معمول، این فایل‌ها در مخزن بررسی می‌شوند تا برای اعتبارسنجی و مهاجرت خودکار استفاده شوند. هنگام مهاجرت به استفاده از افزونه به جای گزینه‌های پردازنده حاشیه‌نویسی، فایل‌های طرحواره موجود باید در دایرکتوری‌های flavor تولید شده توسط افزونه کپی شوند، این یک عملیات مهاجرت یک‌باره است که باید به صورت دستی انجام شود. مستندات طرحواره در developers.android.com در آینده پس از بررسی بازخوردها و رسیدن افزونه به نسخه پایدار، به‌روزرسانی خواهد شد، بنابراین لطفاً آن را امتحان کنید.

تغییرات API

  • RoomDatabase.QueryCallback به عنوان یک رابط کاربردی تعریف شده است تا امکان استفاده از تبدیل SAM را فراهم کند. ( Iab8ea , b/281008549 )

رفع اشکالات

  • حل مشکل پیش آمده هنگام نمونه‌سازی پایگاه داده در Robolectric پس از مهاجرت منابع Room از جاوا به Kotlin. ( Ic053c ، b/274924903 )

نسخه ۲.۶.۰-آلفا۰۱

۲۲ مارس ۲۰۲۳

androidx.room:room-*:2.6.0-alpha01 منتشر شد. نسخه 2.6.0-alpha01 شامل این کامیت‌ها است.

ویژگی‌های جدید

  • پشتیبانی از کلاس‌های مقداری در Room برای KSP. Room اکنون قادر به پشتیبانی از کلاس‌های مقداری در Entityها است. ( 4194095 )
  • اکنون می‌توان تولید کد کاتلین (یا «Kotlin CodeGen») را در Room ( 4297ec0 ) فعال کرد. برای فعال کردن Kotlin CodeGen در Room، نام گزینه room.generateKotlin را به گزینه‌های پردازنده خود برای KSP اضافه کنید. برای جزئیات بیشتر در مورد نحوه ارسال گزینه‌های پردازنده برای KSP، به مستندات KSP مراجعه کنید.

نکته: هنگام استفاده از Kotlin CodeGen، توجه به این نکته ضروری است که محدودیت‌های دیگری نیز اضافه شده است. ویژگی‌های انتزاعی به عنوان دریافت‌کننده‌های DAO یا کوئری‌های DAO در Kotlin CodeGen مجاز نیستند و در عوض انتظار می‌رود که به صورت توابع بازنویسی شوند تا از این تصور غلط که مقدار ویژگی تغییرناپذیر است و نتیجه ذخیره شده ثابتی دارد، جلوگیری شود. محدودیت دیگری که اضافه شده است این است که انواع بازگشتی مجموعه Nullable دیگر در Room for Kotlin CodeGen مجاز نیستند.

هشدار: ممکن است متوجه شوید که پروژه‌های شما هنگام استفاده از Kotlin CodeGen از نظر nullability (تهی‌پذیری) سخت‌گیرانه‌تر هستند. در Kotlin CodeGen، تهی‌پذیری آرگومان‌های نوع مهم است، در حالی که در جاوا این موضوع عمدتاً نادیده گرفته می‌شود. برای مثال، فرض کنید شما یک «جریان» (Flow) دارید. نوع را برگردان و جدول خالی است. در Java CodeGen، این مشکلی ایجاد نمی‌کند، اما در Kotlin CodeGen، با خطا مواجه خواهید شد. برای جلوگیری از این، باید از `Flow` استفاده کنید. با فرض اینکه مقدار null منتشر شده باشد.

تغییرات API

  • محافظت در برابر استفاده بی‌معنی از مجموعه‌های تهی‌پذیر در انواع بازگشتی متد DAO. ( I777dc ، b/253271782 ، b/259426907 )
  • یک API برای ایجاد یک Flow اضافه کنید که تغییرات ردیاب نامعتبرسازی را منتشر کند. این API برای ایجاد جریان‌هایی که نیاز به واکنش به تغییرات پایگاه داده دارند مفید است. ( I8c790 ، b/252899305 )

رفع اشکالات

  • در کدژن کاتلین، به ویژگی‌های انتزاعی به عنوان دریافت‌کننده‌های DAO یا کوئری‌های DAO اجازه ندهید، در عوض باید آنها را به صورت تابع بازنویسی کنید تا از این تصور غلط که مقدار ویژگی تغییرناپذیر است و نتیجه ذخیره شده ثابتی دارد، جلوگیری شود. ( If6a13 , b/127483380 , b/257967987 )

نسخه ۲.۵.۲

نسخه ۲.۵.۲

۲۱ ژوئن ۲۰۲۳

androidx.room:room-*:2.5.2 منتشر شد. نسخه ۲.۵.۲ شامل این کامیت‌ها است.

رفع اشکالات

  • مشکل ناسازگاری با kotlinx-metadata-jvm را برطرف کنید. ( 386d5c )
  • مشکلی را برطرف کنید که باعث می‌شد Room هنگام استفاده در تست Robolectric خطایی نمایش دهد. ( f79bea ، b/274924903 )

نسخه ۲.۵.۱

نسخه ۲.۵.۱

۲۲ مارس ۲۰۲۳

androidx.room:room-*:2.5.1 منتشر شد. نسخه ۲.۵.۱ شامل این کامیت‌ها است.

رفع اشکالات

  • اگر پایگاه داده از قبل باز است، از بررسی دایرکتوری والد پایگاه داده در FrameworkSQLiteHelper خودداری کنید. ( 5de86b8 )
  • هنگام بررسی باز بودن پایگاه داده، از بررسی isOpenInternal استفاده کنید ( e91fb35 )
  • مدیریت بهتر حالت ورود مجدد در acquireTransactionThread() از Room اکنون در دسترس است. ( 219f98b ). در طول یک تراکنش در حال تعلیق، Room از یک نخ از مجری تراکنش استفاده می‌کند، یک حلقه رویداد را در آن شروع می‌کند و عملیات پایگاه داده در حال تعلیق را به آن ارسال می‌کند تا همه آنها در داخل کوروتین تراکنش کپسوله شوند. معمولاً انتظار می‌رود که نخ تراکنش با نخ شروع کننده تراکنش متفاوت باشد، اما در برخی موارد آنها یکسان هستند. برای مدیریت چنین موارد ورود مجددی، withTransaction() به گونه‌ای اصلاح شده است که دیگر به یک کار کنترلی متکی نباشد و در عوض، بلوک تراکنش در حال تعلیق را از داخل runBlocking در نخ تراکنش اجرا کند.

نسخه ۲.۵.۰

نسخه ۲.۵.۰

۲۲ فوریه ۲۰۲۳

androidx.room:room-paging-guava:2.5.0 ، androidx.room:room-paging-rxjava2:2.5.0 و androidx.room:room-paging-rxjava3:2.5.0 منتشر شدند. نسخه 2.5.0 شامل این کامیت‌ها است.

Version 2.5.0

۱۱ ژانویه ۲۰۲۳

androidx.room:room-*:2.5.0 is released. Version 2.5.0 contains these commits.

Important changes since 2.4.0

  • All of room-runtime sources has been converted from Java to Kotlin. Note that you may encounter source incompatibility issues if your code is in Kotlin due to the library conversion to Kotlin. For example, a known source incompatible change is that in InvalidationTracker you will now need to declare onInvalidate() in Observer to have a param of type Set and not MutableSet . Moreover, certain getter methods were converted to properties requiring the property access syntax on Kotlin files. Please file a bug if there are any significant incompatibilities.
  • Added a new shortcut annotation, @Upsert , which attempts to insert an entity when there is no uniqueness conflict or update the entity if there is a conflict. ( I7aaab , b/241964353 )
  • New room-paging artifacts room-paging-rxjava2 , room-paging-rxjava3 and room-paging-guava have been added for support in Room Paging.
  • Added APIs for providing key and value tables names for disambiguation in @MapInfo ( Icc4b5 )

Version 2.5.0-rc01

۷ دسامبر ۲۰۲۲

androidx.room:room-*:2.5.0-rc01 is released. Version 2.5.0-rc01 contains these commits.

  • This release is identical to 2.5.0-beta02 .

Version 2.5.0-beta02

۹ نوامبر ۲۰۲۲

androidx.room:room-*:2.5.0-beta02 is released. Version 2.5.0-beta02 contains these commits.

تغییرات API

  • Fix various APIs that take query arguments from invariant ( Array<Any?> ) to contravariant ( Array<out Any?> ) to match Java's array behavior. ( b/253531073 )

Version 2.5.0-beta01

۵ اکتبر ۲۰۲۲

androidx.room:room-*:2.5.0-beta01 is released. Version 2.5.0-beta01 contains these commits.

تغییرات API

  • Restrict the minimum version that supports @Upsert to be API 16. This is due to the inability to identity a primary key constraint conflict in older APIs. ( I5f67f , b/243039555 )

رفع اشکالات

  • Fixed an issue where shadow tables where incorrectly exported to the schema .json files, corrupting them. ( I4f83b , b/246751839 )

Version 2.5.0-alpha03

August 24, 2022

androidx.room:room-*:2.5.0-alpha03 is released. Version 2.5.0-alpha03 contains these commits.

ویژگی‌های جدید

  • Added a new shortcut annotation, @Upsert , which attempts to insert an entity when there is no uniqueness conflict or update the entity if there is a conflict. ( I7aaab , b/241964353 )

رفع اشکالات

  • Room will now throw a SQLiteConstraintException instead of a IllegalStateException during an auto-migration foreign key constraint check. ( I328dd )
  • Fix a Kotlin source incompatible change for getter / properties of getOpenHelper , getQueryExecutor and getTransactionExecutor . ( Iad0ac )

Version 2.5.0-alpha02

۱ ژوئن ۲۰۲۲

androidx.room:room-*:2.5.0-alpha02 is released. Version 2.5.0-alpha02 contains these commits.

ویژگی‌های جدید

تغییرات API

  • All of room-runtime has been converted from Java to Kotlin. ( If2069 , b/206859668 ),( Ie4b55 , b/206859668 ), ( I697ee , b/206859668 ), ( I96c25 , b/206859668 )

    Note: You may encounter source incompatibility issues due to the library conversion to Kotlin. If your code was in Kotlin and calling the old version of Room, the new version will need to handle these cases. For example, a known source incompatible change is that in InvalidationTracker you will now need to declare onInvalidate() in Observer to have a param of type Set and not MutableSet .

  • Added APIs for providing key and value tables names for disambiguation in @MapInfo ( Icc4b5 )
  • Fix a source compatibility issue to re-allow @Ignore in property getters. ( Ifc2fb )

رفع اشکالات

  • Duplicate column resolution heuristic algorithm. Room will now attempt to resolve ambiguous columns in a multimap query. This allows for JOINs with tables containing same-name tables to be correctly mapped to a result data object. ( I4b444 , b/201306012 , b/212279118 )

Version 2.5.0-alpha01

۲۳ فوریه ۲۰۲۲

androidx.room:room-*:2.5.0-alpha01 is released. Version 2.5.0-alpha01 contains these commits.

تغییرات API

  • Fixed an issue where Room @IntDef usage were not being enforced in Kotlin sources. ( I75f41 , b/217951311 )
  • Fixed a source compatibility issue to re-allow @Query in property getters. ( I0a09b )
  • Converted room-common from Java to Kotlin. ( I69c48 , b/206858235 )

    Note: You may encounter source incompatibility issues as some properties have been moved into companion objects during the library conversion to Kotlin. If your code was in Kotlin and calling the old version of Room, the new version will need the ".Companion" suffix when accessing these properties.

  • Converted room-migration from Java to Kotlin. ( I2724b , b/206858622 )
  • Converted paging related files in room-runtime from Java to Kotlin. ( I82fc8 , b/206859668 )
  • Added API for multi-process lock and usage at the FrameworkSQLite* level, to protect multi-process 1st time database creation and migrations. ( Ied267 , b/193182592 )

رفع اشکالات

  • Added support for internal properties in Kotlin sources. This is a slight behavior change in Room where it will use the source name of functions while matching them to properties as getters/setters (previously, it was using JVM name of the function which is different for internal functions/properties). If you are using custom @JvmName annotations to match getters/setters to private properties, please double check the generated code after the update ( If6531 , b/205289020 )

Version 2.4.3

Version 2.4.3

July 27, 2022

androidx.room:room-*:2.4.3 is released. Version 2.4.3 contains these commits.

رفع اشکالات

  • Fixed an issue that would cause Room to not recognize suspend functions in Kotlin 1.7 ( b/236612358 )

Version 2.4.2

Version 2.4.2

۲۳ فوریه ۲۰۲۲

androidx.room:room-*:2.4.2 is released. Version 2.4.2 contains these commits.

رفع اشکالات

  • Fix an issue generating code for a Dao @Transaction suspend function with a body that generates a default interface method due to compilation with -Xjvm-default=all or equivalent. ( Ia4ce5 )
  • Resolving a bug where Room generates code for a Array<ByteArray> return type query method. ( If086e , b/213789489 )

Version 2.4.1

Version 2.4.1

۱۲ ژانویه ۲۰۲۲

androidx.room:room-*:2.4.1 is released. Version 2.4.1 contains these commits.

رفع اشکالات

  • Added support for internal properties in Kotlin sources. This is a slight behavior change in Room where it will use the source name of functions while matching them to properties as getters/setters (previously, it was using JVM name of the function which is different for internal functions/properties). If you are using custom @JvmName annotations to match getters/setters to private properties, please double check the generated code after the update ( If6531 , b/205289020 )

Version 2.4.0

Version 2.4.0

۱۵ دسامبر ۲۰۲۱

androidx.room:room-*:2.4.0 is released. Version 2.4.0 contains these commits.

Important changes since 2.3.0

  • Auto Migrations : Room now offers an API for automatically generating migrations as long as schemas are exported. To let Room know that it should generate an auto-migration a new property @Database#autoMigrations can be used to declare the versions to auto-migrate from and to. When Room needs additional information regarding tables and column renames or deletes, then the @AutoMigration annotation can declare a specification class containing such inputs. See the @AutoMigration documentation for more details.
  • Dependency Injection in Auto Migrations : @ProvidedAutoMigrationSpec is a new API for declaring that an AutoMigrationSpec will be provided at runtime via RoomDatabase.Builder#addAutoMigrationSpec() . This allows for a dependency injection framework to provide such specs when they need complex dependencies.
  • Migration Test Helper Support for Auto Migrations : Room's MigrationTestHelper was updated to support auto migrations by providing a new constructor API that receives the database class under test. This allows the helper to automatically add auto migrations the same way during runMigrationsAndValidate .
  • Room-Paging Support : androidx.room:room-paging is released, providing native Paging 3.0 support for Room queries returning androidx.paging.PagingSource .
  • Relational Query Methods : Room now supports multimap return types @Dao methods, useful for JOIN statements. The supported types of multimaps are Map , SparseArray , LongSparseArray , along with Guava's ImmutableMap , ImmutableSetMultimap and ImmutableListMultimap .

Version 2.4.0-rc01

December 1, 2021

androidx.room:room-*:2.4.0-rc01 is released. Version 2.4.0-rc01 contains these commits.

ویژگی‌های جدید

  • Update Room's dependency on KSP to 1.6.0-1.0.1 to support Kotlin 1.6

Version 2.4.0-beta02

۱۷ نوامبر ۲۰۲۱

androidx.room:room-*:2.4.0-beta02 is released. Version 2.4.0-beta02 contains these commits.

ویژگی‌های جدید

  • We've added support for SparseArray and LongSparseArray in @MapInfo. ( Ic91a2 b/138910317 )

رفع اشکالات

  • We've added a new TypeConverter analyzer that takes nullability information in types into account. As this information is only available in KSP, it is turned on by default only in KSP. If it causes any issues, you can turn it off by passing room.useNullAwareTypeAnalysis=false to the annotation processor. If that happens, please a file bug as this flag will be removed in the future. With this new TypeConverter analyzer, it is suggested to only provide non-null receiving TypeConverters as the new analyzer has the ability to wrap them with a null check. Note that this has no impact for users using KAPT or Java as the annotation processors (unlike KSP), don't have nullability information in types. ( Ia88f9 , b/193437407 )
  • Fix a bug where Room would fail to compile with a SQL error when an FTS entity declared to use the ICU tokenizer. ( I00db9 , b/201753224 )
  • Resolved issue in auto migrations regarding a new column added to an embedded Entity between versions. ( I5fcb1 b/193798291 )
  • We have resolved an issue regarding the relational query method return types in LEFT JOIN queries. With these changes, in the case where a 1-many mapping is present, the collection returned for a key will not include the invalid value object if it is not found in the cursor. If no valid values are found, then a key will be mapped to an empty collection. ( Id5552 b/201946438 )
  • Resolved the auto migration issue where SQLite keywords failed to be escaped in column names. ( Idbed4 b/197133152 )

Version 2.4.0-beta01

۱۳ اکتبر ۲۰۲۱

androidx.room:room-*:2.4.0-beta01 is released. Version 2.4.0-beta01 contains these commits.

رفع اشکالات

  • Fixed an issue with auto-migrations not adding new columns when another table in the same auto-migration also had a new column with the same name. ( Ia5db5 , b/200818663 )
  • The PagingSource implementation generated by room-paging now uses the queryExecutor passed through RoomDatabase.Builder , so it can be overridden, instead of Dispatchers.IO previously. ( Iae259 )

Version 2.4.0-alpha05

September 29, 2021

androidx.room:room-*:2.4.0-alpha05 is released. Version 2.4.0-alpha05 contains these commits.

ویژگی‌های جدید

تغییرات API

  • Added a new property to the TypeConverters annotation to let developers disable built-in Enum and UUID converters. By default, these converters are on but you can disable them for a certain scope, or for the whole database. See TypeConverters documentation for details. ( 36ae9e , b/195413406 )

  • Supporting non-POJO keys/values for Multimap return types in DAOs via the @MapInfo annotation. ( I4d704 )

@MapInfo will be required when the key or value column of the map are from a single column. See example:

@MapInfo(valueColumn = "songCount")
@Query("""
       SELECT *, COUNT(mSongId) as songCount
       FROM Artist JOIN Song ON Artist.artistName = Song.artist
       GROUP BY artistName
       """)
fun getArtistAndSongCounts(): Map<Artist, Integer>
  • Make room-paging a required artifact when using Paging3 with Room. ( Ieaffe )

رفع اشکالات

  • Fix an issue where multimap queries results were not correctly ordered when the query contained an ORDER BY clause of a column from the map's key. ( I6b887 )

External Contribution

  • Added new API to specify index order in @Index. Thanks to Nikita Zhelonkin. ( I033fc )

Version 2.4.0-alpha04

۲۱ ژوئیه ۲۰۲۱

androidx.room:room-*:2.4.0-alpha04 is released. Version 2.4.0-alpha04 contains these commits.

ویژگی‌های جدید

  • Room now supports multimap return types @Dao methods, useful for JOIN statements. The supported types of multimaps are Map along with Guava's ImmutableMap , ImmutableSetMultimap and ImmutableListMultimap .

    The following are examples of multimap queries:

    One-to-One Relation Map

    @Query("SELECT * FROM Song JOIN Artist ON Song.artistId = Artist.artistId")
    fun getSongAndArtist(): Map<Song, Artist>
    

    One-to-Many Relation Map (Standard multimap)

    @Query("SELECT * FROM Artist JOIN Album ON Artist.id = Album.artistId")
    fun getArtistAndAlbums(): Map<Artist, List<Album>>
    

    The multimap result can also be wrapped in the supported async return types, such as LiveData , Rx's Observable , or coroutines Flow .

Room-Paging

  • androidx.room:room-paging is released, providing native Paging 3.0 support for Room queries returning androidx.paging.PagingSource .

    @Dao
    interface UserDao {
      @Query("SELECT * FROM users ORDER BY id ASC")
      fun loadUsers(): PagingSource<Int, User>
    }
    
  • This artifact replaces the androidx.paging.PagingSource implementation generated by Room with one built on top of Paging 3.0 APIs. The new PagingSource implementation parses keys differently, so any key manually supplied to Room's PagingSource would need to account for this behavior change, including the initialKey passed via Pager's constructor. Pages will start loading from the Key with Key being the first loaded item. This deviates from existing behavior where LoadParams.Refresh.Key is treated as the user's scroll position and items are loaded both before and after the key.

  • The artifact is optional and opting out will fallback to existing support for Paging 3.0 that was introduced in Room 2.3. However, this artifact will become non-optional in future release for those using Room with Paging 3.0. To opt-in, add the new room-paging artifact to your classpath. If you are using Gradle, you can add the following snippet to your build.gradle:

    dependency {
      implementation("androidx.room:room-paging:2.4.0-alpha04")
    }
    

رفع اشکالات

  • Fix an issue in auto migrations regarding handling foreign key violations. ( b/190113935 )

Version 2.4.0-alpha03

۱۶ ژوئن ۲۰۲۱

androidx.room:room-*:2.4.0-alpha03 is released. Version 2.4.0-alpha03 contains these commits.

تغییرات API

  • Update Room's MigrationTestHelper to support auto migrations by providing a new constructor API that receives the database class under test. This allows the helper to automatically add auto migrations the same way during runMigrationsAndValidate .

رفع اشکالات

  • Fixed an issue with Room's SQLite native library to support Apple's M1 chips. ( b/174695268

  • Fixed an issue where Room would not error out when the return type of a @Transaction function was a Flow ( I56ddd , b/190075899 )

  • Fix an issue in auto migrations regarding indices. b/177673291

به‌روزرسانی‌های وابستگی

  • Room's KSP support now depends on KSP 1.5.10-1.0.0-beta01 . ( 1ecb11 , b/160322705 )

Version 2.4.0-alpha02

May 5, 2021

androidx.room:room-*:2.4.0-alpha02 is released. Version 2.4.0-alpha02 contains these commits.

تغییرات API

  • @ProvidedAutoMigrationSpec is a new API for declaring that an AutoMigrationSpec will be provided at runtime via RoomDatabase.Builder#addAutoMigrationSpec() . This allows for a dependency injection framework to provide such specs when they need complex dependencies.

رفع اشکالات

  • Fix an issue with auto migrations where @DatabaseView s where not being properly re-created.

External Contribution

  • Fix an issue in Room's JournalMode.TRUNCATE where the InvalidationTracker callback was sometimes being invoked invalidly, too late, or not at all. Thanks to Uli Bubenheimer | bubenheimer@users.noreply.github.com ( b/154040286 )

Version 2.4.0-alpha01

۲۱ آوریل ۲۰۲۱

androidx.room:room-*:2.4.0-alpha01 is released. Version 2.4.0-alpha01 contains these commits.

ویژگی‌های جدید

  • Auto Migrations : Room now offers an API for automatically generating migrations as long as schemas are exported. To let Room know that it should generate an auto-migration a new property @Database#autoMigrations can be used to declare the versions to auto-migrate from and to. When Room needs additional information regarding tables and column renames or deletes, then the @AutoMigration annotation can declare a specification class containing such inputs. See the @AutoMigration documentation for more details.

رفع اشکالات

  • Fix an issue where defaultValue with extra parenthesis were being incorrectly validated by Room's schema validation. b/182284899

Version 2.3.0

Version 2.3.0

۲۱ آوریل ۲۰۲۱

androidx.room:room-*:2.3.0 is released. Version 2.3.0 contains these commits.

Important changes since 2.2.0

  • Built-in Enum Support : Room will now default to using an Enum to String and vice versa type converter if none is provided. If a type converter for an enum already exists, Room will prioritize using it over the default one.
  • Query Callback : Room now offers a general callback API RoomDatabase.QueryCallback, for when queries are about to execute, which can be useful for logging in debug builds. The callback can be set via RoomDatabase.Builder#setQueryCallback() .
  • Pre-packaged Improvement : Room now has APIs for creating a database using a pre-packaged database read from an input stream. This allows for cases such as when the pre-package database is gzipped.
  • Provided Type Converters : Room now has APIs for providing instances of type converters such that the app can control their initialization. To mark a type converter that will be provided to Room use the new annotation @ProvidedTypeConverter.
  • RxJava3 Support : Room now supports RxJava3 types. Similar to RxJava2 you can declare DAO methods whose return type are Flowable, Single, Maybe and Completable. Additionally a new artifact androidx.room:room-rxjava3 is available to support RxJava3.
  • Paging 3.0 Support : Room will now support generating implementations for @Query annotated methods whose return type is androidx.paging.PagingSource .

Version 2.3.0-rc01

۲۴ مارس ۲۰۲۱

androidx.room:room-*:2.3.0-rc01 is released. Version 2.3.0-rc01 contains these commits.

رفع اشکالات

  • Fix an issue that prevented Coroutine Flow queries created by Room to be consumed in a suspending withTransaction block. ( I797bf )

Version 2.3.0-beta03

۱۰ مارس ۲۰۲۱

androidx.room:room-*:2.3.0-beta03 is released. Version 2.3.0-beta03 contains these commits.

ویژگی‌های جدید

رفع اشکالات

  • Fixed a bug where creating PagingSource on the main thread could trigger an ANR. ( I42b74 , b/181221318 )
  • Fixed @ExperimentalRoomApi visibility to be public instead of package private. ( b/181356119 )

External Contribution

  • Allow Room to accept a POJO return type in a @Query annotated DAO method when it is also annotated with @SkipQueryVerification . Room will do a best-effort to convert the result of the query to the POJO return type the same way it is done for a @RawQuery annotated DAO method. Thanks to 'Markus Riegel | hey@marcorei.com'. ( I45acb )

Version 2.3.0-beta02

۱۸ فوریه ۲۰۲۱

androidx.room:room-*:2.3.0-beta02 is released. Version 2.3.0-beta02 contains these commits.

ویژگی‌های جدید

  • Room now has experimental support for Kotlin Symbol Processing KSP .

    KSP is a replacement for KAPT to run annotation processors natively on the Kotlin compiler, significantly reducing build times.

    To use Room with KSP, you can apply the KSP Gradle plugin and replace the kapt configuration in your build file with ksp . For example, instead of kapt 'androidx.room:room-compiler:2.3.0-beta02' use ksp 'androidx.room:room-compiler:2.3.0-beta02' . See the KSP documentation for more details.

    Note that since KSP is experimental, it is recommended to still use KAPT for production code. The reduction of build times is only applicable if there are no other processors that use KAPT. See b/160322705 for known issues.

Version 2.3.0-beta01

۲۷ ژانویه ۲۰۲۱

androidx.room:room-*:2.3.0-beta01 is released. Version 2.3.0-beta01 contains these commits.

ویژگی‌های جدید

  • Auto Closable Databases : Room now has the ability to close databases that are not accessed after a given amount of time. This is an experimental feature and can be enabled by calling RoomDatabase.Builder#setAutoCloseTimeout() . This feature is useful for applications with multiple databases.

رفع اشکالات

  • Fix an issue where Dao methods with multiple @Update or @Delete methods with different conflict strategies would generate code with only one of the strategies, effectively ignoring the defined one. ( /I0b90d , b/176138543 )

Version 2.3.0-alpha04

۱۶ دسامبر ۲۰۲۰

androidx.room:room-*:2.3.0-alpha04 is released. Version 2.3.0-alpha04 contains these commits.

ویژگی‌های جدید

  • Room now offers a general callback API RoomDatabase.QueryCallback , for when queries are about to execute, which can be useful for logging in debug builds. The callback can be set via RoomDatabase.Builder#setQueryCallback() . ( Iaa513 , b/174478034 , b/74877608 )
  • Room will now default to using an Enum to String and vice versa type converter if none is provided. If a type converter for an enum already exists, Room will prioritize using it over the default one. ( b/73132006 )

مشکل شناخته شده

  • If a one-way type converter for reading already exists for the Enum, Room might accidentally use the built-in String to Enum converter which might not be desired. This is a known issue and can be fixed by making it a two-way converter. See: b/175707691

رفع اشکالات

  • Fixed an issue where Room would incorrectly disabled incremental annotation processing in newer JDK versions. ( b/171387388 )
  • Fixed an issue with Room finding the generated class when multiple class loaders are used. Thanks for the fix 'Serendipity | 892449346@qq.com'! ( b/170141113 )
  • Fixed an issue where Room would generate incorrect code when a Kotlin @Dao had a base class whose generics are primitives in the JVM. ( b/160258066 )

External Contribution

  • Room will now default to using beginTransactionNonExclusive if WAL mode is enabled and API is 16 or more. Thanks to 'Ahmed I. Khalil | ahmedibrahimkhali@gmail.com'! ( b/126258791 )

Version 2.3.0-alpha03

۱۴ اکتبر ۲۰۲۰

androidx.room:room-*:2.3.0-alpha03 is released. Version 2.3.0-alpha03 contains these commits.

ویژگی‌های جدید

  • Room now has APIs for providing instances of type converters such that the app can control their initialization. To mark a type converter that will be provided to Room use the new annotation @ProvidedTypeConverter . Thanks to 'mzgreen yairobbe@gmail.com '. ( Ie4fa5 , b/121067210 )

  • Room now has APIs for creating a database using a pre-packaged database read from an input stream. This allows for cases such as when the pre-package database is gzipped. Thanks to 'Ahmed El-Helw ahmedre@gmail.com ' ( 3e6792 , b/146911060 )

تغییرات API

  • Added missing target to @ForeignKey annotation preventing its usage outside of the @Entity annotation. ( Iced1e )

  • The field mCallbacks in RoomDatabase.java is now hidden. ( d576cb , b/76109329 )

رفع اشکالات

  • Update to TypeConverters documentation to clarify that TypeConverters can only be used to convert columns / fields and not rows. ( I07c56 , b/77307836 )

  • Update to the DaoProcessor to fix compiler error on Dao with a generic super type with Kotlin "primitives". ( Ice6bb , b/160258066 )

  • Update add/remove observer methods documentation to clarify threading ( Ifd1d9 , b/153948821 )

  • Fix an issue with Room incorrectly validating FTS tables that declared their rowid column. ( d62ebc , b/145858914 )

External Contributions

  • Fix upper/lowercase locale issues related to Turkish ( 5746e3 ), b/68159494

  • Replace the ConcurrentHashMap inside RoomDatabase with Collections.synchronizedMap() to avoid issues on Android Lollipop ( d1cfc7 , b/162431855 )

  • Add a onOpenPrepackagedDatabase callback for when a prepackaged DB is copied. ( I1ba74 , b/148934423 )

Version 2.3.0-alpha02

۲۲ ژوئیه ۲۰۲۰

androidx.room:room-*:2.3.0-alpha02 is released. Version 2.3.0-alpha02 contains these commits.

ویژگی‌های جدید

  • RxJava3 Support : Room now supports RxJava3 types. Similar to RxJava2 you can declare DAO methods whose return type are Flowable, Single, Maybe and Completable. Additionally a new artifact androidx.room:room-rxjava3 is available to support RxJava3. ( b/152427884 )

تغییرات API

  • Declaring a @TypeConverter in Kotlin Object class is now supported. ( b/151110764 )
  • Room incremental annotation processing option is now ON by default. ( b/112110217 )

Version 2.3.0-alpha01

June 10, 2020

androidx.room:room-*:2.3.0-alpha01 is released. Version 2.3.0-alpha01 contains these commits.

ویژگی‌های جدید

  • Paging 3.0 Support : Room will now support generating implementations for @Query annotated methods whose return type is androidx.paging.PagingSource .

    @Dao
    interface UserDao {
      @Query("SELECT * FROM users ORDER BY id ASC")
      fun pagingSource(): PagingSource<Int, User>
    }
    

تغییرات API

  • @RewriteQueriesToDropUnusedColumns is a new convenient annotation that makes Room rewrite the '*' projection in a query such that unused columns in the result are removed.
  • The processor option room.expandProjection is now deprecated. Use @RewriteQueriesToDropUnusedColumns as a replacement for Room optimizing queries with star projections. Note that @RewriteQueriesToDropUnusedColumns does not replace the column conflict solution room.expandProjection offered with regards to return types that contained @Embedded fields.

رفع اشکالات

  • Fixed a bug where Room would not correctly detect the JDK version used to enable incremental annotation processor. Thanks to Blaz Solar (me@blaz.solar) ( b/155215201 )
  • Room now embeds its ANTLR dependency with the annotation processor to avoid version conflicts with other processors that also use ANTLR. ( b/150106190 )

Version 2.2.6

Version 2.2.6

۱۶ دسامبر ۲۰۲۰

androidx.room:room-*:2.2.6 is released. Version 2.2.6 contains these commits.

رفع اشکالات

  • Fixed an issue where Room would incorrectly disabled incremental annotation processing in newer JDK versions. ( b/171387388 )

Version 2.2.5

Version 2.2.5

March 18, 2020

androidx.room:room-*:2.2.5 is released. Version 2.2.5 contains these commits.

رفع اشکالات

  • Make MultiInstanceInvalidationService directBootAware. Thanks to 'Mygod contact-git@mygod.be ' ( b/148240967 )
  • Fixed a bug that would cause a crash when multi-instance invalidation was enabled and the database contained a FTS entity. ( b/148969394 )
  • Fixed an issue when loading the SQLite native libraries in the Room annotation processor that would cause the compiler to crash due to parallel compilations. ( b/146217083 )

Version 2.2.4

Version 2.2.4

۱۹ فوریه ۲۰۲۰

androidx.room:room-common:2.2.4 , androidx.room:room-compiler:2.2.4 , androidx.room:room-guava:2.2.4 , androidx.room:room-ktx:2.2.4 , androidx.room:room-migration:2.2.4 , androidx.room:room-runtime:2.2.4 , androidx.room:room-rxjava2:2.2.4 , and androidx.room:room-testing:2.2.4 are released. Version 2.2.4 contains these commits.

رفع اشکالات

  • Fixed an issue with suspending transactions where they would deadlock if the coroutine was canceled quickly before the transaction actually started. ( b/148181325 )
  • Fixed an issue with the @Generated being wrongly used when building with JDK 9. ( b/146538330 )
  • Fixed an issue where Room would generate incorrect code when a DAO interface in Kotlin had a concrete function. ( b/146825845 )

Version 2.2.3

Version 2.2.3

December 18, 2019

androidx.room:room-*:2.2.3 is released. Version 2.2.3 contains these commits .

رفع اشکالات

  • Fixed a bug where Room would fail to validate a database that had not gone through any migration and contained a legacy hash with indices in its schema. ( b/139306173 )

Version 2.2.2

Version 2.2.2

۲۰ نوامبر ۲۰۱۹

androidx.room:room-*:2.2.2 is released. Version 2.2.2 contains these commits .

رفع اشکالات

  • Fixed a bug where collecting a one-to-one relationship with more than 999 rows would cause Room to return null relating items. ( b/143105450 )

Version 2.2.1

Version 2.2.1

October 23, 2019

androidx.room:room-*:2.2.1 is released. Version 2.2.1 contains these commits .

رفع اشکالات

  • Fixed a bug where Room would incorrectly warn about CURSOR_MISMATCH with the compiler option expandProjection turned ON. ( b/140759491 )
  • Added a retry mechanism for handling the missing native library used for verifying queries during compile time.

Version 2.2.0

Version 2.2.0

۹ اکتبر ۲۰۱۹

androidx.room:room-*:2.2.0 is released. Version 2.2.0 contains these commits .

Important changes since version 2.1.0

  • Pre-packaged Database : Two new APIs in RoomDatabase.Builder are now available for creating a RoomDatabase given an already populated database file. createFromAsset() is for when the pre-populated database file is in the assets folder of the APK, while createFromFile() is for when the file is in an arbitrary location. The usages of these API change the behaviour of destructive migrations such that during a fallback migration, Room will try to re-copy the pre-populated database if available, otherwise it fallbacks to just dropping and re-creating all tables. b/62185732
  • Schema Default Values : @ColumnInfo now has a new property defaultValue that can be used to specify the default value of a column. Default values are part of a database schema and will be validated during migrations if specified. b/64088772
  • Many-to-Many Relations : @Relation now has a new property associateBy , that takes in a new annotation @Junction , used to declare a relation that needs to be satisfied via a junction table (also known as a join table). b/69201917
  • One-to-One Relations : The restriction in POJO fields annotated with @Relation to be of type List or Set has been lifted, effectively allowing single-value relations to be represented. b/62905145
  • Target Entity : The DAO annnotations @Insert , @Update and @Delete now has a new property targetEntity , that allows specifying the target table the DAO method is meant to act on. This allows for the parameters of those DAO methods to be arbitrary POJOs which will be interpreted as partial entities. In practice, this allows partial inserts, deletes and updates. b/127549506
  • Coroutines Flow : @Query DAO methods can now be of return type Flow<T> . The returned Flow will re-emit a new set of values if the observing tables in the query are invalidated. Declaring a DAO function with a Channel<T> return type is an error, Room instead encourages you to use Flow and then use the neighboring functions to convert the Flow into a Channel . b/130428884
  • Gradle Incremental Annotation Processor : Room is now a Gradle isolating annotation processor and incrementability can be enabled via the processor option room.incremental . See Room Compiler Options for more information. If you encounter any issues please file a bug here . We plan to enable incrementability by default in a future, stable version. b/112110217
  • Expanding Projections : A new experimental compiler option room.expandProjection was added that causes Room to rewrite a query with a star projection to only contain the columns in the returning type POJO. For example, for a DAO method with @Query("SELECT * FROM Song") that returns a POJO named SongIdAndTitle with only two fields. Then Room will rewrite the query to SELECT id, title FROM Song such that the minimum set of columns to satisfy the return type are fetched. This essentially eliminates the CURSOR_MISMATCH warning that is presented when the query returns extra columns that do not match any field in the returning POJO type.

Version 2.2.0-rc01

۵ سپتامبر ۲۰۱۹

androidx.room:room:2.2.0-rc01 is released. The commits included in this version can be found here .

No public changes since Room 2.2.0-beta01 .

Version 2.2.0-beta01

August 22, 2019

androidx.room:room-*:2.2.0-beta01 is released. The commits included in this version can be found here .

رفع اشکالات

  • Fixed a bug where a Coroutine Flow query would stop reemitting new values after a certain time. ( b/139175786 )
  • Fixed a bug where Room would not accept a legacy schema hash code while opening a database that had not gone a migration since Room 1.0, causing a runtime crash due to invalid schema. ( b/139306173 )

Version 2.2.0-alpha02

۷ آگوست ۲۰۱۹

androidx.room:room-*:2.2.0-alpha02 is released. The commits included in this version can be found here .

ویژگی‌های جدید

  • Coroutines Flow : @Query DAO methods can now be of return type Flow<T> . The returned Flow will re-emit a new set of values if the observing tables in the query are invalidated. Declaring a DAO function with a Channel<T> return type is an error, Room instead encourages you to use Flow and then use the neighboring functions to convert the Flow into a Channel . b/130428884
  • Expanding Projections : A new experimental compiler option room.expandProjection was added that causes Room to rewrite a query with a star projection to only contain the columns in the returning type POJO. For example, for a DAO method with @Query("SELECT * FROM Song") that returns a POJO named SongIdAndTitle with only two fields. Then Room will rewrite the query to SELECT id, title FROM Song such that the minimum set of columns to satisfy the return type are fetched. This essentially eliminates the CURSOR_MISMATCH warning that is presented when the query returns extra columns that do not match any field in the returning POJO type.
  • onDestructiveMigrate is a new callback API added to RoomDatabase.Callback for when Room destructively migrates a database. b/79962330

رفع اشکالات

  • Fixed a bug where Room would generate incorrect code using a method as field setter when the field is protected. b/136194628
  • Fixed a bug that caused the InvalidationTracker to throw a NPE in a second process when multi-instance invalidation was enabled and the invalidation Service was killed. b/137454915
  • Fixed a bug where Room would not correctly identify the return type of an inherited suspend function annotated with @RawQuery . b/137878827
  • Updated the generated code for @Relation when the relating key is of type BLOB to use a ByteBuffer that is comparable. b/137881998
  • Fixed a bug where Room would complain about missing setters on POJOs used as partial entity parameters of @Insert , @Update and @Delete . b/138664463
  • Fixed a bug where Room would complain about missing getters & setters for an ignored column via @Entity when the entity class was used in certain DAO methods. b/138238182
  • Fixed a bug where Room would not correctly convert named binding args to positional args causing a runtime exception when executing a query with re-used parameters. b/137254857

Version 2.2.0-alpha01

July 10, 2019

ویژگی‌های جدید

  • Pre-packaged Database : Two new APIs in RoomDatabase.Builder are now available for creating a RoomDatabase given an already populated database file. createFromAsset() is for when the pre-populated database file is in the assets folder of the APK, while createFromFile() is for when the file is in an arbitrary location. The usages of these API change the behaviour of destructive migrations such that during a fallback migration, Room will try to re-copy the pre-populated database if available, otherwise it fallbacks to just dropping and re-creating all tables. b/62185732
  • Schema Default Values : @ColumnInfo now has a new property defaultValue that can be used to specify the default value of a column. Default values are part of a database schema and will be validated during migrations if specified. b/64088772

    Note: If your database schema already has default values, such as those added via ALTER TABLE x ADD COLUMN y INTEGER NOTNULL DEFAULT z , and you decide to define default values via @ColumnInfo to the same columns, then you might need to provide a migration to validate the unaccounted default values. See Room Migrations for more information.

  • Many-to-Many Relations : @Relation now has a new property associateBy , that takes in a new annotation @Junction , used to declare a relation that needs to be satisfied via a junction table (also known as a join table). b/69201917
  • One-to-One Relations : The restriction in POJO fields annotated with @Relation to be of type List or Set has been lifted, effectively allowing single-value relations to be represented. b/62905145
  • Target Entity : The DAO annnotations @Insert , @Update and @Delete now has a new property targetEntity , that allows specifying the target table the DAO method is meant to act on. This allows for the parameters of those DAO methods to be arbitrary POJOs which will be interpreted as partial entities. In practice, this allows partial inserts, deletes and updates. b/127549506
  • Gradle Incremental Annotation Processor : Room is now a Gradle isolating annotation processor and incrementability can be enabled via the processor option room.incremental . See Room Compiler Options for more information. If you encounter any issues please file a bug here . We plan to enable incrementability by default in a future, stable version. b/112110217

رفع اشکالات

  • Room will no longer propagate the EmptySetResultException to the global error handler when the Rx stream of a query has been disposed before the query is complete. b/130257475
  • Fixed a bug where Room would show an incorrect error message when a suspend DAO function annotated with @RawQuery didn't have a return type. b/134303897
  • Room will no longer generate DAO adapters with raw types. b/135747255

Version 2.1.0

Version 2.1.0

۱۳ ژوئن ۲۰۱۹

Room 2.1.0 is released with no changes from 2.1.0-rc01 . The commits included in the version can be found here .

Important changes since 2.0.0

  • FTS : Room now supports entities with a mapping FTS3 or FTS4 table. Classes annotated with @Entity can now be additionally annotated with @Fts3 or @Fts4 to declare a class with a mapping full-text search table. FTS options for further customization are available via the annotation's methods.
  • Views : Room now supports declaring a class as a stored query, also known as a view , using the @DatabaseView annotation.
  • Couroutines : DAO methods can now be suspend functions. Include room-ktx in your dependencies to take advantage of this functionality. The ktx artifact also provides the extension function RoomDatabase.withTransaction for performing database transactions within a coroutine.
  • Auto Value : Room now supports declaring AutoValue annotated classes as entities and POJOs. The Room annotations @PrimaryKey , @ColumnInfo , @Embedded and @Relation can now be declared in an auto value annotated class's abstract methods. Note that these annotation must also be accompanied by @CopyAnnotations for Room to properly understand them.
  • Additional Async Support : DAO methods annotated with @Insert , @Delete or @Update , along with @Query containing INSERT , DELETE or UPDATE statements, now support Rx return types Completable , Single , Maybe , and Guava's return type ListenableFuture , and they can also be suspend functions.
  • enableMultiInstanceInvalidation is a new API in RoomDatabase.Builder to enable invalidation across multiple instances of RoomDatabase using the same database file.
  • fallbackToDestructiveMigrationOnDowngrade is a new API in RoomDatabase.Builder to automatically re-create the database if a downgrade happens.
  • ignoredColumns is a new API in the @Entity annotation that can be used to list ignored fields by name.
  • Room will now properly use Kotlin's primary constructor in data classes avoiding the need to declare the properties as vars .

Version 2.1.0-rc01

May 29, 2019

رفع اشکالات

  • Fixed a Room initialization error that might occur due to an already setup temp_store configuration. b/132602198
  • Fixed a double quote usage warning for users with SQLite 3.27.0 and above. b/131712640
  • Fixed a bug where the InvalidationTracker would cause a crash when multiple invalidation checks would occur in parallel. b/133457594

Version 2.1.0-beta01

۷ مه ۲۰۱۹

androidx.room 2.1.0-beta01 is released with no changes from 2.1.0-alpha07. The commits included in this version can be found here .

Version 2.1.0-alpha07

۲۵ آوریل ۲۰۱۹

API / Behavior Changes

  • The extension function RoomDatabase.withTransaction has been changed to no longer take a function block with a CoroutineScope as receiver. This prevents skipping the additional coroutineScope { } wrapper required to run things in the transaction block concurrently.

رفع اشکالات

  • Fixed a bug where Room would fail to match a TypeConverter for a Kotlin DAO function containing a parameter of Collection type. b/122066791

Version 2.1.0-alpha06

۲۲ مارس ۲۰۱۹

API / Behavior Changes

  • Async transaction queries are now serialized such that Room will not use more than one thread for executing database transactions. RoomDatabase.Builder.setTransactionExecutor(Executor) was added to allow configuring the executor to be used for transactions.
  • RoomDatabase.runInTransaction(Callable) will no longer wrap checked exceptions into RuntimeExceptions. b/128623748

رفع اشکالات

  • Fixed a bug where the invalidation tracker would stop observing a content table if observers for both the content table and an external content FTS table were added. b/128508917
  • Updated Room SQLite grammar to match SQLite 3.24.0. b/110883668

Version 2.1.0-alpha05

۱۳ مارس ۲۰۱۹

ویژگی‌های جدید

  • The extension function RoomDatabase.withTransaction allows you to safely perform database transactions within a coroutine. Room extensions functions along with coroutines support are available in the room-ktx artifact.
  • Non-abstract DAO methods annotated with @Transaction can now be suspend functions. b/120241587

API / Behavior Changes

  • The artifact room-coroutines has been renamed to room-ktx following the same naming as other androidx artifacts.
  • beginTransaction , setTransactionSuccessful and endTransaction in RoomDatabase have been deprecated in favor of runInTransaction and the room-ktx extension function withTransaction .

رفع اشکالات

  • Fixed a bug where tokenizer arguments were being dropped if the tokenizer used was SIMPLE. b/125427014
  • Fixed a bug where Room would fail to correctly identify suspending functions with parameters whos type were an inner class. b/123767877
  • Fixed a bug where deferred @Query DAO method with INSERT , UPDATE or DELETE statements were eagerly preparing the query in the main thread. b/123695593
  • Fixed various bugs where Room would generate incorrect code for certain suspend functions. b/123466702 and b/123457323
  • Fixed a bug where deprecated usage of methods were not being correctly suppressed in generated code. b/117602586
  • Updated Room dependency of androidx.sqlite to 1.0.2 which contain fixes for correctly handling corrupted databases. b/124476912

مشکلات شناخته شده

  • Room 2.1.0-alpha05 depends on the kotlinx-metadata-jvm artifact which is not currently available in Maven Central ( KT-27991 ). This dependency can be resolved by adding maven { url "https://kotlin.bintray.com/kotlinx/" } to your project repositories.

Version 2.1.0-alpha04

۲۵ ژانویه ۲۰۱۹

ویژگی‌های جدید

  • DAO methods annotated with @Query containing INSERT , UPDATE or DELETE statements can now return async types Single , Mayble , Completable and ListenableFuture . Additionally they can also be suspend functions. b/120227284

API / Behavior Changes

  • Room will now throw an error if a non-abstract DAO method annotated with @Transaction returns an async type such as Single , Mayble , Completable , LiveData or ListenableFuture . Since transactions are thread confined it is currently impossible for Room to begin and end a transaction around a function that may peform queries in different threads. b/120109336
  • OnConflictStrategy.FAIL and OnConflictStrategy.ROLLBACK have been @Deprecated since they do not behave as intended with Android's current SQLite bindings. b/117266738

رفع اشکالات

  • Fixed a bug where Room wouldn't correctly use the TypeConverter of a return type if the DAO method was a suspend function. b/122988159
  • Fixed a bug where Room would incorrectly identify inherited suspend functions as non-suspending. b/122902595
  • Fixed a bug where Room would generate incorrect code when an @Embedded field was in a parent class and used in multiple child classes. b/121099048
  • Fixed an issue where the database would deadlock when invoking DAO suspend functions between a beginTransaction() and endTransaction() . b/120854786

Version 2.1.0-alpha03

December 4, 2018

تغییرات API

  • The FTS tokenizer in @Fts3 / @Fts4 now takes a String instead of an Enum. This allows custom tokenizers to be used by Room. Built-in tokenizers are still defined in FtsOptions as string constants. b/119234881

ویژگی‌های جدید

  • Couroutines : DAO methods can now be suspend functions. To support suspend functions in Room a new artifact has been released, room-coroutines . b/69474692
  • DAO methods annotated with @Insert , @Delete or @Update now support ListenableFuture as return type. b/119418331

رفع اشکالات

  • Fixed a bug where Room would incorrectly attempt to find a constructor with columns in the ignoredColumns property of @Entity . b/119830714
  • Fixed a bug where Room would not mark DAO method parameters as final in their generated implementation. b/118015483
  • Fixed a bug where Room processor would crash when reporting an error on a query with special symbols. b/119520136
  • Fixed a bug where Room would decline other various Collection implementations as arguments of an IN expression. b/119884035
  • Fixed a bug where LiveData returned from Room would get garbage collected when observed forever causing it to no longer emit new data. b/74477406
  • Updated RoomDatabase 's close lock to reduce lock contention. b/117900450

Version 2.1.0-alpha02

۳۰ اکتبر ۲۰۱۸

ویژگی‌های جدید

  • Added support for referencing a @DatabaseView in a @Relation . b/117680932

رفع اشکالات

  • Fixed a bug where Room would perform disk I/O in the main thread when subscribing and disposing from an Rx return type. b/117201279
  • Fixed a bug where Room would fail to find an appropriate type converter for a field in a Kotlin entity class. b/111404868
  • Fixed a bug where Room would generate incorrect code for a DAO interface implementation containing a Kotlin default method that has no arguments. b/117527454
  • Updated Room SQLite grammar parser, fixing a performance issue that would cause long build times. b/117401230

Version 2.1.0-alpha01

October 8, 2018

ویژگی‌های جدید

  • FTS : Room now supports entities with a mapping FTS3 or FTS4 table. Classes annotated with @Entity can now be additionally annotated with @Fts3 or @Fts4 to declare a class with a mapping full-text search table. FTS options for further customization are available via the annotation's methods. b/62356416
  • Views : Room now supports declaring a class as a stored query, also known as a view using the @DatabaseView annotation. b/67033276
  • Auto Value : Room now supports declaring AutoValue annotated classes as entities and POJOs. The Room annotations @PrimaryKey , @ColumnInfo , @Embedded and @Relation can now be declared in an auto value annotated class' abstract methods. Note that these annotation must also be accompanied by @CopyAnnotations for Room to properly understand them. b/62408420
  • Additional Rx Return Types Support : DAO methods annotated with @Insert , @Delete or @Update now support Rx return types Completable , Single<T> and Maybe<T> . b/63317956
  • Immutable Types with @Relation : Room previously required @Relation annotated fields to be settable but now they can be constructor parameters.
  • enableMultiInstanceInvalidation : Is a new API in RoomDatabase.Builder to enable invalidation across multiple instances of RoomDatabase using the same database file. This multi-instance invalidation mechanism also works across multiple processes. b/62334005
  • fallbackToDestructiveMigrationOnDowngrade : Is a new API in RoomDatabase.Builder to automatically re-create the database if a downgrade happens. b/110416954
  • ignoredColumns : Is a new API in the @Entity annotation that can be used to list ignored fields by name. Useful for ignoring inherited fields on an entity. b/63522075

API / Behavior Changes

  • mCallback and mDatabase in RoomDatabase are now @Deprecated and will be removed in the next major version of Room. b/76109329

رفع اشکالات

  • Fixed two issues where Room wouldn't properly recover from a corrupted database or a bad migration during initialization. b/111504749 and b/111519144
  • Room will now properly use Kotlin's primary constructor in data classes avoiding the need to declare the fields as vars . b/105769985

نسخه ۲.۰.۰

نسخه ۲.۰.۰

October 1, 2018

androidx.room 2.0.0 is released with no changes from 2.0.0-rc01.

Version 2.0.0-rc01

September 20, 2018

androidx.room 2.0.0-rc01 is released with no changes from 2.0.0-beta01.

Version 2.0.0-beta01

۲ ژوئیه ۲۰۱۸

API / Behavior Changes

  • Added RoomDatabase.Builder.setQueryExecutor() to allow customization of where queries are run
  • Added RxJava2 Observable support
  • Generated DAO and Database implementations are now final

رفع اشکالات

  • Specify class/field name in "cannot find getter for field" error b/73334503
  • Fixed RoomOpenHelper backwards compatibility with older versions of Room b/110197391

Pre-AndroidX Dependencies

For the pre-AndroidX versions of Room, include these dependencies:

dependencies {
    def room_version = "1.1.1"

    implementation "android.arch.persistence.room:runtime:$room_version"
    annotationProcessor "android.arch.persistence.room:compiler:$room_version" // For Kotlin use kapt instead of annotationProcessor

    // optional - RxJava support for Room
    implementation "android.arch.persistence.room:rxjava2:$room_version"

    // optional - Guava support for Room, including Optional and ListenableFuture
    implementation "android.arch.persistence.room:guava:$room_version"

    // Test helpers
    testImplementation "android.arch.persistence.room:testing:$room_version"
}

نسخه ۱.۱.۱

نسخه ۱.۱.۱

June 19, 2018

Room 1.1.1 is identical to Room 1.1.1-rc1 .

Version 1.1.1-rc1

May 16, 2018 We highly recommend using Room 1.1.1-rc1 instead of 1.1.0 if you are using migrations.

Fixed a bug where Room would not handle post migration initialization properly b/79362399

نسخه ۱.۱.۰

Version 1.1.0-beta3

April 19, 2018

رفع اشکالات

  • Fix compilation error when a Kotlin POJO references a relation entity that was defined in Java b/78199923

Version 1.1.0-beta2

April 5, 2018

رفع اشکالات

  • Fixed a critical bug in Room Rx Single and Maybe implementations where it would recycle the query ahead of time, causing problems if you add more than 1 observer to the returned Single or Maybe instances. b/76031240

  • [RoomDatabase.clearAllTables][ref-clearAllTables] will not VACUUM the database if it is called inside a transaction. b/77235565

Version 1.1.0-beta1

March 21, 2018

تغییرات API

  • Based on API Review feedback, @RawQuery does not accept passing a String as the query parameter anymore. You need to use [SupportSQLiteQuery][ref-SupportSQLiteQuery]. (see [SimpleSQLiteQuery][ref-SimpleSQLiteQuery] to easily create an instance of [SupportSQLiteQuery][ref-SupportSQLiteQuery] with argument support).
  • RoomDatabase.Builder's [fallbackToDestructiveMigrationFrom][ref-fallbackToDestructiveMigrationFrom] method now accepts vararg int instead of vararg Integer .

رفع اشکالات

  • [RoomDatabase.clearAllTables][ref-clearAllTables] now tries to return space back to the operating system by setting a WAL checkpoint and VACUUM ing the database.
  • [ @RawQuery ][ref-RawQuery] now accepts any Pojo for the observedEntities property as long as the Pojo references to one or more entities via its Embedded fields or Relation s. b/74041772
  • Paging: Room's DataSource implementation now correctly handles multi-table dependencies (such as relations, and joins). Previously these would fail to trigger new results, or could fail to compile. b/74128314

Version 1.1.0-alpha1

January 22, 2018

ویژگی‌های جدید

  • RawQuery : This new API allows @Dao methods to receive the SQL as a query parameter b/62103290 , b/71458963
  • fallBackToDestructiveMigrationsFrom : This new API in RoomDatabase.Builder allows for finer grained control over from which starting schema versions destructive migrations are allowed (as compared to fallbackToDestructiveMigration) b/64989640
  • Room now only supports newer Paging APIs (alpha-4+), dropping support for the deprecated LivePagedListProvider . To use the new Room alpha, you'll need to use paging alpha-4 or higher, and switch from LivePagedListProvider to LivePagedListBuilder if you haven't already.

رفع اشکالات

  • Improved support for Kotlin Kapt types. b/69164099
  • Order of fields do not invalidate schema anymore. b/64290754