اتاق
آخرین به روز رسانی | انتشار پایدار | کاندید را آزاد کنید | نسخه بتا | انتشار آلفا |
---|---|---|---|---|
8 اکتبر 2025 | 2.8.2 | - | - | - |
اعلام وابستگی ها
برای افزودن وابستگی به Room، باید مخزن Google Maven را به پروژه خود اضافه کنید. برای اطلاعات بیشتر، مخزن Maven Google را بخوانید.
وابستگیهای اتاق شامل آزمایش مهاجرتهای اتاق و اتاق RxJava است
وابستگیهای مصنوعات مورد نیاز خود را در فایل build.gradle
برای برنامه یا ماژول خود اضافه کنید:
کاتلین
dependencies { val room_version = "2.8.2" 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.2" 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 مراجعه کنید.
برای اطلاعات در مورد استفاده از پسوندهای Kotlin، به مستندات ktx مراجعه کنید.
برای اطلاعات بیشتر درباره وابستگیها، به افزودن وابستگیهای ساخت مراجعه کنید.
به صورت اختیاری، برای کتابخانههای غیر اندروید (یعنی فقط ماژولهای Gradle جاوا یا Kotlin) میتوانید برای استفاده از حاشیهنویسی اتاق به androidx.room:room-common
وابسته باشید.
پیکربندی گزینه های کامپایلر
اتاق دارای گزینه های پردازشگر حاشیه نویسی زیر است.
room.schemaLocation | directory صادرات طرحواره های پایگاه داده به فایل های JSON در فهرست داده شده را فعال می کند. برای اطلاعات بیشتر به اتاق مهاجرت مراجعه کنید. |
room.incremental | boolean پردازشگر حاشیه نویسی افزایشی Gradle را فعال می کند. مقدار پیش فرض true است. |
room.generateKotlin | boolean به جای جاوا فایل های منبع Kotlin را تولید کنید. به KSP نیاز دارد. مقدار پیش فرض در نسخه 2.7.0 true است. برای جزئیات بیشتر به یادداشتهای نسخه 2.6.0 ، زمانی که معرفی شد، مراجعه کنید. |
از پلاگین Room Gradle استفاده کنید
با نسخه Room 2.6.0 و بالاتر، می توانید از پلاگین 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") } }
هنگام استفاده از پلاگین Room Gradle، تنظیم یک schemaDirectory
مورد نیاز است. این کامپایلر اتاق و وظایف مختلف کامپایل و باطنهای آن (javac، KAPT، KSP) را برای خروجی فایلهای طرحواره در پوشههای طعمدار، برای مثال schemas/flavorOneDebug/com.package.MyDatabase/1.json
، پیکربندی میکند. این فایلها باید در مخزن بررسی شوند تا برای اعتبارسنجی و مهاجرتهای خودکار استفاده شوند.
برخی از گزینه ها را نمی توان در تمام نسخه های پلاگین Room Gradle پیکربندی کرد، حتی اگر توسط کامپایلر Room پشتیبانی شوند. جدول زیر هر گزینه را فهرست میکند و نسخه پلاگین Room Gradle را نشان میدهد که برای پیکربندی آن گزینه با استفاده از افزونه room
پشتیبانی میکند. اگر نسخه شما پایینتر است، یا اگر این گزینه هنوز پشتیبانی نمیشود، میتوانید به جای آن از گزینههای پردازشگر حاشیهنویسی استفاده کنید.
گزینه | از نسخه |
---|---|
room.schemaLocation (الزامی) | 2.6.0 |
room.incremental | - |
room.generateKotlin | - |
از گزینه های پردازشگر حاشیه نویسی استفاده کنید
اگر از افزونه Room Gradle استفاده نمیکنید، یا اگر گزینه مورد نظر توسط نسخه افزونه شما پشتیبانی نمیشود، میتوانید اتاق را با استفاده از گزینههای پردازشگر حاشیهنویسی پیکربندی کنید، همانطور که در Add build dependencies توضیح داده شده است. نحوه تعیین گزینه های حاشیه نویسی به استفاده از KSP یا KAPT برای اتاق بستگی دارد.
شیار
// 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 هنگام بررسی های به روز از این دایرکتوری مطلع شود. مهاجرت پایگاه داده اتاق شما اجرای کامل CommandLineArgumentsProvider
را نشان می دهد که مکان طرح را ارائه می دهد.
بازخورد
بازخورد شما به بهتر شدن Jetpack کمک می کند. اگر مسائل جدیدی کشف کردید یا ایده هایی برای بهبود این کتابخانه دارید، به ما اطلاع دهید. لطفاً قبل از ایجاد کتابخانه جدید، به مسائل موجود در این کتابخانه نگاهی بیندازید. با کلیک کردن روی دکمه ستاره می توانید رای خود را به یک موضوع موجود اضافه کنید.
برای اطلاعات بیشتر به مستندات ردیاب مشکل مراجعه کنید.
نسخه 2.8
نسخه 2.8.2
08 اکتبر 2025
androidx.room:room-*:2.8.2
منتشر شد. نسخه 2.8.2 شامل این commit ها است.
رفع اشکال
- بنبستی را که ممکن است هنگام باز کردن مجدد پایگاه داده بستهشده خودکار از انتشار جریان ( b/446643789 ) رخ دهد، برطرف کنید.
نسخه 2.8.1
24 سپتامبر 2025
androidx.room:room-*:2.8.1
منتشر شد. نسخه 2.8.1 حاوی این commit ها است.
رفع اشکال
- خرابی پردازنده را که هنگام پردازش یک عملکرد DAO با لامبدا معلق رخ می دهد، برطرف کنید. ( b/442220723 ).
- یک وضعیت مسابقه را برطرف کنید که از دریافت آخرین بهروزرسانیهای Flow جلوگیری میکند.
نسخه 2.8.0
10 سپتامبر 2025
androidx.room:room-*:2.8.0
منتشر شد. نسخه 2.8.0 شامل این commit ها است.
تغییرات مهم از 2.7.0:
- یک مصنوع جدید
androidx.room:room-sqlite-wrapper
اضافه شد که حاوی APIهایی برای دریافت یک پوششSupportSQLiteDatabase
از یکRoomDatabase
با یکSQLiteDriver
پیکربندی شده است. برای دریافت wrapper از تابع افزونه جدیدRoomDatabase.getSupportWrapper()
استفاده کنید. این یک مصنوع سازگاری برای حفظ استفاده ازSupportSQLiteDatabase
است که معمولاً ازroomDatabase.openHelper.writableDatabase
بدست می آید، حتی اگر پایگاه داده اتاق باSQLiteDriver
پیکربندی شده باشد. این بسته بندی برای انتقال تدریجی پایگاه های کدی که مایل به استفاده از API های SQLiteDriver هستند، اما استفاده های گسترده ای از API های SupportSQLite دارند، اما می خواهند از مزایایBundledSQLiteDriver
استفاده کنند، مفید است. برای اطلاعات بیشتر راهنمای مهاجرت را بررسی کنید. - پشتیبانی از اهداف KMP Watch OS و TV OS اضافه شد.
- MinSDK اندروید کتابخانه را از API 21 به API 23 به روز کرد
نسخه 2.8.0-rc02
27 آگوست 2025
androidx.room:room-*:2.8.0-rc02
منتشر شد. نسخه 2.8.0-rc02 حاوی این commit ها است.
تغییرات API
- minSDK را از API 21 به API 23 بهروزرسانی کنید ( Ibdfca , b/380448311 , b/435705964 , b/435705223 )
- حداقل نسخه Android Gradle Plugin (AGP) سازگار با پلاگین Room Gradle را از 8.1 به 8.4 به روز کنید. ( Ia0d28 )
رفع اشکال
- مشکلی را برطرف کنید که در آن یک مهاجرت مخرب انجام میشد، حتی اگر یک مسیر مهاجرت برای یک پایگاه داده از پیش بستهبندی شده ( b/432634197 ) در دسترس بود.
نسخه 2.8.0-rc01
13 آگوست 2025
androidx.room:room-*:2.8.0-rc01
منتشر شد. نسخه 2.8.0-rc01 حاوی این commit ها است.
تغییرات API
رفع اشکال
- یک وضعیت مسابقه را که در آن Room Flow آخرین نتیجه جستجو را در وضعیت چند پرس و جو/نوشتن ناهمزمان منتشر نمی کند، برطرف کنید. ( Ic9a3c )
نسخه 2.8.0-beta01
1 آگوست 2025
androidx.room:room-*:2.8.0-beta01
منتشر شد. نسخه 2.8.0-beta01 حاوی این تعهدات است.
رفع اشکال
- نام جدول و نما اکنون در طول مهاجرت های مخرب به درستی فرار می شود. ( 9e55f8 , b/427095319 )
نسخه 2.8.0-alpha01
16 جولای 2025
androidx.room:room-*:2.8.0-alpha01
منتشر شد. نسخه 2.8.0-alpha01 حاوی این تعهدات است.
ویژگی های جدید
- یک مصنوع جدید
androidx.room:room-sqlite-wrapper
اضافه شد که حاوی APIهایی برای دریافت یک پوششSupportSQLiteDatabase
ازRoomDatabase
با یکSQLiteDriver
پیکربندی شده است. برای دریافت wrapper از تابع افزونه جدیدRoomDatabase.getSupportWrapper()
استفاده کنید. این یک مصنوع سازگاری برای حفظ استفاده ازSupportSQLiteDatabase
است که معمولاً ازRoomDatabase.openHelper.writableDatabase
بدست می آید، حتی اگر پایگاه داده اتاق باSQLiteDriver
پیکربندی شده باشد. این پوشش برای انتقال تدریجی پایگاههای کدی که مایل به استفاده ازSQLiteDriver
هستند، اما استفاده گستردهای از APIهایSupportSQLite
دارند، اما میخواهند از مزایایBundledSQLiteDriver
استفاده کنند، مفید است. ( ICF6ac ) - اهداف KMP را برای Watch OS و TV OS اضافه کنید ( I228f6 , b/394238801 )
رفع اشکال
- بنبستی را که گاهی ممکن است هنگام استفاده از تعلیق تراکنشها و
AndroidSQLiteDriver
رخ دهد، برطرف کنید. ( b/415006268 )
نسخه 2.7
نسخه 2.7.2
18 ژوئن 2025
androidx.room:room-*:2.7.2
منتشر شد. نسخه 2.7.2 حاوی این commit ها است.
رفع اشکال
- مشکلی را برطرف کنید که در آن مقادیر حاشیه نویسی هنگام پردازش منابع بومی با KSP اشتباه خوانده میشوند، و گاهی اوقات صادرات طرحواره وجود ندارد. ( b/416549580 )
- رفع اشکالی که در آن نظرات پیشرو در یک SQL باعث میشود که عبارات بهگونهای اجرا شوند که گویی عبارتهایی خوانده نشده هستند. ( b/413061402 )
- مشکل پیکربندی نشدن پلاگین Gradle Room به دلیل خالی بودن دایرکتوری طرحواره را برطرف کنید. ( b/417823384 )
- هنگامی که اتصال طولانی طول می کشد، دیگر
SQLiteException
پرتاب نکنید، در عوض یک پیام گزارش توسط کتابخانه ارسال می شود. Logging به جای پرتاب کردن در اطراف iOS باعث تعلیق حلقههای iOS میشود و باعث میشود Room تایماوت را که در Kotlin Coroutine ایجاد میشود به اشتباه تفسیر کند و بنابراین از ایجاد استثنا در زمانی که یک برنامه iOS در پسزمینه قرار میگیرد و بعداً در میانه عملیات پایگاه داده از سر گرفته میشود، جلوگیری میکند. ( b/422448815 )
نسخه 2.7.1
23 آوریل 2025
androidx.room:room-*:2.7.1
منتشر شد. نسخه 2.7.1 شامل این commit ها است.
رفع اشکال
- در طول اعتبارسنجی مبدل نوع ارائه شده، اشکال
IndexOutOfBoundsException
برطرف کنید. ( b/409804755 ). - هنگامی که یک
SQLiteDriver
با Room پیکربندی شده است ازRoomDatabase.runInTransaction()
پشتیبانی کنید. ( b/408364828 ).
نسخه 2.7.0
9 آوریل 2025
androidx.room:room-*:2.7.0
منتشر شد. نسخه 2.7.0 حاوی این تعهدات است.
تغییرات مهم از 2.6.0
- پشتیبانی از چند پلتفرم Kotlin (KMP): در این نسخه، Room به یک کتابخانه چند پلتفرمی Kotlin (KMP) تبدیل شده است. پلتفرمهای پشتیبانی شده فعلی Android، iOS، JVM (Desktop)، Mac بومی و لینوکس بومی هستند. برای اطلاعات بیشتر در مورد نحوه شروع استفاده از Room KMP، لطفاً به مستندات رسمی اتاق KMP مراجعه کنید. بهعنوان بخشی از پشتیبانی KMP، اتاق را میتوان با
SQLiteDriver
نیز پیکربندی کرد، برای اطلاع از نحوه انتقال یک برنامه موجود به APIهای درایور و به اتاق KMP، به مستندات مهاجرت مراجعه کنید. - اگر پردازش از طریق KSP انجام شود، تولید کد Kotlin در KSP به طور پیش فرض روشن شده است. برای پروژههای فقط KAPT یا جاوا، Room همچنان منابع جاوا را تولید میکند.
- Kotlin 2.0 و KSP2: Room اکنون زبان Kotlin 2.0 را هدف قرار می دهد و به پروژه ها نیز نیاز دارد که با Kotlin 2.0 و نسخه زبان معادل یا بالاتر کامپایل شوند. پشتیبانی از KSP2 نیز اضافه شده است و هنگام استفاده از Room با Kotlin 2.0 یا بالاتر توصیه می شود.
نسخه 2.7.0-rc03
26 مارس 2025
androidx.room:room-*:2.7.0-rc03
منتشر شد. نسخه 2.7.0-rc03 حاوی این commit ها است.
رفع اشکال
- هنگامی که یک رشته در طول اجرای APIهای مسدودکننده اتاق، از جمله مسدود کردن توابع DAO ( b/400584611 ) قطع میشود، دیگر
InterruptedException
پرتاب نکنید. - اجرای مجدد مخزن اتصال اتاق در تلاش برای کاهش
SQLException: Error code: 5, message: Timed out attempting to acquire a reader connection.
و مسائل مشابه ( b/380088809 ).
نسخه 2.7.0-rc02
12 مارس 2025
androidx.room:room-*:2.7.0-rc02
منتشر شد. نسخه 2.7.0-rc02 حاوی این commit ها است.
رفع اشکال
- رفع اشتباه انتقال خودکار ستون جدید در جدول FTS. ( b/348227770 , Ic53f3 )
- رفع خرابی کامپایلر اتاق به دلیل
NullPointerException
هنگام پردازش منابع غیر JVM از طریق KSP. ( b/396607230 , I693c9 ) - مشکلی را برطرف کنید که در آن Room جداول را در پایان استفاده از اتصال نویسنده باطل نمیکند. ( b/340606803 , I73ef6 )
نسخه 2.7.0-rc01
26 فوریه 2025
androidx.room:room-*:2.7.0-rc01
منتشر شد. نسخه 2.7.0-rc01 حاوی این commit ها است.
رفع اشکال
- مشکلی را برطرف کنید که در آن 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 ).
نسخه 2.7.0-beta01
12 فوریه 2025
androidx.room:room-*:2.7.0-beta01
منتشر شد. نسخه 2.7.0-beta01 حاوی این تعهدات است.
رفع اشکال
- مشکل را با
RoomDatabase.inTransaction()
که یک پایگاه داده بسته را باز می کند در حالی که نباید این کار را انجام دهد برطرف کنید و اگر پایگاه داده بسته شود باید به سرعت false را برگرداند ( b/325432967 ). - هنگام پردازش توابع DAO با کلاس های درون خطی / مقدار Kotlin ( b/388299754 ) یک خرابی (
IllegalArgumentException: not a valid name
) در کامپایلر Room را برطرف کنید. - قوانین Proguard را در مصنوع JVM در
room-runtime
قرار دهید تا سازنده پیشفرض پیادهسازی پایگاه داده تولید شده حذف نشود زیرا توسط مقداردهی اولیه اتاق که از بازتاب استفاده میکند ( b/392657750 ) استفاده میشود.
نسخه 2.7.0-alpha13
29 ژانویه 2025
androidx.room:room-*:2.7.0-alpha13
منتشر شد. نسخه 2.7.0-alpha13 حاوی این commit ها است.
تغییرات API
- اتاق اکنون زبان Kotlin 2.0 را هدف قرار می دهد و پروژه ها را نیز با Kotlin 2.0 و نسخه معادل یا زبان بالا کامپایل می کند. ( I8efb0 , b/315461431 , b/384600605 )
رفع اشکال
- هنگامی که در Android از یک نام ساده به جای مسیر استفاده میشود و مسیر حلشده فایل پایگاه داده در فهرست دادههای برنامه قرار نمیگیرد، مشکلی را در سازنده پایگاه داده Room KMP برطرف کنید. ( I83315 , b/377830104 )
- مشکلی را در افزونه Room Gradle برطرف کنید که در آن پیکربندی ورودیها و خروجیهای طرحواره باعث ایجاد مشکل در پروژههای Android میشد:
property 'inputDirectory' is final and cannot be changed any further.
( 1dbb4c , b/376071291 ) - برای رفع مشکلی که دایرکتوری طرحواره به درستی توسط افزونه تنظیم نشده بود، پشتیبانی از KSP2 را در افزونه Room Gradle اضافه کنید. ( Iec3c4 , b/379159770 )
مشارکت خارجی
- مشکل یکپارچهسازی صفحهبندی
Room
را برطرف کنید که باعث میشود در زمانی که کلید اولیه برای بازخوانی به انتهای فهرست نزدیک است، UI پرش کند. با تشکر از اوا! ( I2abbe , b/389729367 )
نسخه 2.7.0-alpha12
11 دسامبر 2024
androidx.room:room-*:2.7.0-alpha12
منتشر شد. نسخه 2.7.0-alpha12 حاوی این commit ها است.
تغییرات API
- API آزمایشی
RoomDatabase.Builder.setInMemoryTrackingMode()
را اضافه کنید تا پیکربندی کنید که آیا Room از جدول درون حافظه برای ردیابی عدم اعتبار استفاده کند یا خیر. ( I2a9b2 , b/185414040 )
رفع اشکال
- مهاجرتهای مخرب اکنون نماها را حذف میکنند تا اطمینان حاصل شود که دوباره ایجاد میشوند، و رفتار زمانی که
allowDestructiveMigrationForAllTables
روشن است (پیشفرض KMP) با رفتار موجود در حالت خاموش همسو میشود. ( 0a3e83 , b/381518941 )
نسخه 2.7.0-alpha11
30 اکتبر 2024
androidx.room:room-*:2.7.0-alpha11
منتشر شد. نسخه 2.7.0-alpha11 حاوی این commit ها است.
تغییرات API
- امضای متد
convertRows()
که به تازگی اضافه شده را مجدداً مشاهده کنید تا یک تابع تعلیق باشد کهRawRoomQuery
را برای صفحهبندی اتاق دریافت میکند. ( Ie57b5 , b/369136627 )
رفع اشکال
- مشکل در صفحهبندی اتاق که در آن کد نامعتبر هنگام استفاده از
@Relation
در ارتباط باPagingSource
ایجاد میشد، برطرف شد.
نسخه 2.7.0-alpha10
16 اکتبر 2024
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 )
نسخه 2.7.0-alpha09
2 اکتبر 2024
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 )
نسخه 2.7.0-alpha08
18 سپتامبر 2024
androidx.room:room-*:2.7.0-alpha08
منتشر شد. نسخه 2.7.0-alpha08 حاوی این commit ها است.
ویژگی های جدید
- مصنوعات
room-paging
برای سازگاری با KMP مهاجرت کردهاند. ( Ib8756 , b/339934824 ) - API
invalidationTrackerFlow()
به عنوان یک API شخص اول با نامInvalidationTracker.createFlow()
رایج شده است و اکنون برای مجموعههای منبع غیر Android در پروژههای KMP در دسترس است. ( I1fbfa , ( I8fb29 ), b/329291639 , b/329315924 )
تغییرات API
- همه هشدارها و پیامهای خطا در اتاق که از کلمه
Cursor
استفاده میکنند حذف یا جایگزین شدهاند، زیراCursor
دیگر یک اصطلاح کلی دقیق برای استفاده در نسخه KMP اتاق نیست. ( ID8cd9 , b/334087492 )
رفع اشکال
- مشکلی را که در آن Room KMP سعی میکرد با استفاده از
UUID
برای پلتفرمهای غیرJVM کد ارسال کند، برطرف شد. ( b/362994709 ) - مشکلی در پلاگین Room Gradle برطرف شد که در هنگام استفاده در پروژه KMP با Compose Multiplatform خطایی مانند «نمیتوان ویژگیهای پیکربندی را تغییر داد … پس از قفل شدن برای جهش» ایجاد میکرد. ( b/343408758 )
نسخه 2.7.0-alpha07
21 آگوست 2024
androidx.room:room-*:2.7.0-alpha07
منتشر شد. نسخه 2.7.0-alpha07 حاوی این commit ها است.
ویژگی های جدید
- پلاگین Room Gradle اکنون به طور خودکار طرحواره های صادر شده را به منابع منبع تست ابزار دقیق Android اضافه می کند تا بتوان از آنها توسط
MigrationTestHelper
استفاده کرد.
رفع اشکال
- اگر چنین تابعی در اعلان «انتظار» نیز لغو شود، مشکل «واقعی» ایجاد شده در
RoomDatabaseConstructor
که اصلاحگر «واقعی» را در تابعinitialize
از دست داده بود، برطرف شد. ( 359631627 ) - مشکلی را که مربوط به «واقعی» ایجاد شده در
RoomDatabaseConstructor
با قابلیت مشاهده اعلان «انتظار» مطابقت نداشت برطرف شد. ( 358138953 )
نسخه 2.7.0-alpha06
7 آگوست 2024
androidx.room:room-*:2.7.0-alpha06
منتشر شد. نسخه 2.7.0-alpha06 حاوی این commit ها است.
تغییرات API
- تنظیمات instantiation را برای
RoomDatabase
در یک پروژه KMP تغییر دهید.
با توجه به مدل کامپایل Kotlin 2.0، استراتژی ارجاع به یک تابع تولید شده با نام instantiateImpl()
طولانی تر است. دو API جدید به @ConstructedBy
و RoomDatabaseConstructor
معرفی شدهاند که جایگزین استراتژی instantiateImpl()
میشوند. استراتژی جدید به شرح زیر است:
یک شیء انتظار را تعریف کنید که
RoomDatabaseConstructor
را پیاده سازی می کندexpect object MyDatabaseCtor : RoomDatabaseConstructor<MyDatabase>
با استفاده از
@ConstructedBy
شی را با اعلان@Database
پیوند دهید@Database(...) @ConstructedBy(MyDatabaseCtor::class) // NEW abstract class MyDatabase : RoomDatabase
یک نمونه پایگاه داده جدید اما بدون ارسال آرگومان کارخانه ایجاد کنید
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
که شبیه بهSupportSQLiteQuery
از نظر نگهداری در رشته خام SQL و تابعی برای اتصال آرگومان ها به یک عبارت است. توابع حاشیه نویسی@RawQuery
اکنون می توانند یکRoomRawQuery
به عنوان پارامتر واحد خود بپذیرند. ( Iea844 , b/330586815 ) - اضافه باری از
setQueryCallback()
اضافه کنید که یکCoroutineContext
می پذیرد. ( Id66ff , b/309996304 ) - پشتیبانی از اهداف چند پلتفرمی
linuxArm64
Kotlin ( I139d3 , b/338268719 ) اضافه شد
رفع اشکال
- مشکلی را برطرف کنید که در آن Room به اشتباه به
recursiveFetchArrayMap
در اهداف غیر اندرویدی فراخوانی میدهد. ( 710c36 , b/352482325 ) - مشکلی را برطرف کنید که در آن اتاق گاهی اوقات در پروژه KMP استثنایی در مورد «بهمدت زمانبندی تلاش برای اتصال» ایجاد میکند. ( fa72d0 , b/347737870 )
- مشکلی را در مهاجرتهای خودکار برطرف کنید که باعث میشود قبل از اینکه جدولهای دیگر طرحهای خود را برای مطابقت با کلیدهای خارجی جدید تغییر دهند، خیلی زود کلیدهای خارجی را بررسی میکنند. ( 7672c0 , b/352085724 )
نسخه 2.7.0-alpha05
10 جولای 2024
androidx.room:room-*:2.7.0-alpha05
منتشر شد. نسخه 2.7.0-alpha05 حاوی این commit ها است.
تغییرات API
-
SQLiteKt
بهSQLite
وBundledSQLiteKt
بهBundledSQLite
تغییر نام داد. ( I8b501 )
رفع اشکال
- رفع اشکالی که در آن
RoomDatabase
در هنگام استفاده ازAndroidSQLiteDriver
به بنبست میخورد یا با وقفه اتصال با خطا مواجه میشد.
نسخه 2.7.0-alpha04
12 ژوئن 2024
androidx.room:room-*:2.7.0-alpha04
منتشر شد. نسخه 2.7.0-alpha04 حاوی این commit ها است.
رفع اشکال
- رفع مشکلی در پردازنده حاشیه نویسی اتاق که باعث ایجاد کد KMP ناسازگار در هنگام تعریف نوع بازگشت چند نقشه در DAO می شد. ( b/340983093 )
- مشکلی را برطرف کرد که در آن اتاق نمیتوانست پیادهسازی پایگاه داده تولید شده را پیدا کند، اگر کلاس مشروح پایگاه داده
@Database
فاقد بسته باشد. ( b/342097292 ) - مشکلی را برطرف کرد که در آن فعال کردن بسته شدن خودکار و بی اعتباری چند نمونه ای گاهی اوقات باعث ایجاد Exception
ConcurrentModificationException
در زمانی که پایگاه داده به دلیل غیرفعال بودن خودکار بسته می شد، برطرف شد.
نسخه 2.7.0-alpha03
29 مه 2024
androidx.room:room-*:2.7.0-alpha03
منتشر شد. نسخه 2.7.0-alpha03 حاوی این commit ها است.
رفع اشکال
- مشکلات مختلف مربوط به Kotlin 2.0 و KSP 2.0 را برطرف کنید. توجه داشته باشید که Kotlin 2.0 با پشتیبانی KSP 2 کامل نیست و تیم در حال کار بر روی API های مختلف و تغییرات رفتاری در کامپایلر جدید است. ( b/314151707 )
نسخه 2.7.0-alpha02
14 مه 2024
androidx.room:room-*:2.7.0-alpha02
منتشر شد. نسخه 2.7.0-alpha02 حاوی این تعهدات است.
رفع اشکال
- رفع مشکلات مختلف KSP.
نسخه 2.7.0-alpha01
1 مه 2024
androidx.room:room-*:2.7.0-alpha01
منتشر شد. نسخه 2.7.0-alpha01 حاوی این commit ها است.
ویژگی های جدید
- پشتیبانی از چند پلتفرم Kotlin (KMP) : در این نسخه، Room به یک کتابخانه چند پلتفرمی Kotlin (KMP) تبدیل شده است. اگرچه هنوز مقداری کار برای انجام وجود دارد، این نسخه نسخه جدیدی از Room را معرفی می کند که در آن اکثر عملکردها "مشترک" شده اند (ساخته شده برای چند پلتفرم). پلتفرمهای پشتیبانی شده فعلی Android، iOS، JVM (Desktop)، Mac بومی و لینوکس بومی هستند. هر گونه عملکردی که در پلتفرمهای جدید پشتیبانی شده وجود نداشته باشد، در نسخههای اتاق آینده "کامل با ویژگی" خواهد شد.
برای اطلاعات بیشتر در مورد نحوه شروع استفاده از Room KMP، لطفاً به مستندات رسمی اتاق KMP مراجعه کنید.
- اگر پردازش از طریق KSP انجام شود، تولید کد Kotlin در KSP به طور پیش فرض روشن شده است. برای پروژههای فقط KAPT یا جاوا، Room همچنان منابع جاوا را تولید میکند.
تغییرات API
- اضافه بار از
Room.databaseBuilder()
اضافه شده است که یک پارامتر lambda را می گیرد که قرار است با یک تابع ایجاد شده اتاق استفاده شود تا از بازتاب در هنگام نمونه سازی اجرایRoomDatabase
تولید شده جلوگیری شود. مثال استفاده این است:
Room.databaseBuilder<MyDatabase>(
context = appContext,
name = dbFilePath,
factory = { MyDatabase::class.instantiateImpl() }
)
- یک API برای پیکربندی اتاق با
CoroutineContext
به سازنده اضافه شده است:RoomDatabase.Builder.setQueryCoroutineContext
. توجه داشته باشید که یکRoomDatabase
فقط می توان با مجریانی که ازsetQueryExecutor
استفاده می کنند یا با زمینه Coroutine پیکربندی کرد، اما نه هر دو. - یک API برای پیکربندی اتاق با درایور
SQLite
اضافه شده است:RoomDatabase.Builder.setDriver()
. برای اطلاعات بیشتر در موردSQLite
Driver API به مستندات SQLite KMP مراجعه کنید - APIهایی برای دسترسی به
SQLiteConnection
اساسی از APIهای درایور اضافه شده است:RoomDatabase.useReaderConnection
وRoomDatabase.useWriterConnection
. - تماسهای مربوط به اتاق Varios اکنون یک نسخه بارگذاری شده دارند که به جای
SupportSQLiteDatabase
SQLiteConnection
دریافت میکند. این موارد در نظر گرفته شده است که هنگام مهاجرت به یک پروژه KMP نادیده گرفته شوند. برای اطلاعات بیشتر در مورد انتقال استفاده از اتاق در یک برنامه Android به یک ماژول معمولی 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
ادغام شده است، این مصنوع اکنون خالی است. لطفاً آن را از لیست وابستگی خود حذف کنید.
نسخه 2.6
نسخه 2.6.1
29 نوامبر 2023
androidx.room:room-*:2.6.1
منتشر شد. نسخه 2.6.1 حاوی این commit ها است.
رفع اشکال
- مشکل در کد ایجاد شده حل شد که در آن مقدار پیشفرض برای ستونهای Double در
EntityCursorConverter
به جای 0.0 روی 0 تنظیم شده بود. یک اصلاح بالقوه برای یک لبه مشابه برای ستونهای نوع Float نیز گنجانده شده است. ( Id75f5 , b/304584179 ) - استثناهای پرتاب شده از بارهای
PagingSource
اکنون به عنوان یکLoadStateUpdate
ازLoadResult.Error
حاوی Throwable منتشر می شود. این حالت خطا از طریقPagingDataAdapter.loadStateFlow(Views)
یاLazyPagingItems.loadState(Compose)
قابل مشاهده است. توجه داشته باشید که این یک تغییر رفتاری را نشان میدهد که در آن خطاهای بارگذاری گذشته به عنوان یک استثنا ایجاد میشوند که توسط روش dao که بار را راهاندازی میکند، ایجاد میشود. ( I93887 , b/302708983 )
نسخه 2.6.0
18 اکتبر 2023
androidx.room:room-*:2.6.0
منتشر شد. نسخه 2.6.0 حاوی این commit ها است.
تغییرات مهم از 2.5.0
- گزینه فعال کردن تولید کد Kotlin (یا "Kotlin CodeGen") اکنون در Room KSP موجود است. ( 4297ec0 ). برای روشن کردن Kotlin CodeGen در اتاق، نام گزینه
room.generateKotlin
را به گزینه های پردازنده خود برای KSP اضافه کنید. برای جزئیات بیشتر در مورد نحوه انتقال گزینه های پردازنده برای KSP، به مستندات KSP مراجعه کنید.
توجه: هنگام استفاده از Kotlin CodeGen، مهم است که توجه داشته باشید که محدودیتهای اضافی اضافه شده است. ویژگیهای انتزاعی بهعنوان دریافتکننده DAO یا پرسوجوهای DAO در Kotlin CodeGen غیرمجاز هستند، و در عوض انتظار میرود که بهعنوان توابع بازنویسی شوند تا از این تصور غلط مبنی بر اینکه مقدار ویژگی تغییرناپذیر است و یک نتیجه ذخیره شده ثابت دارد، جلوگیری شود. محدودیت دیگری که اضافه شده است این است که انواع بازگشت مجموعه Nullable دیگر در Room for Kotlin CodeGen مجاز نیستند.
هشدار: ممکن است متوجه شوید که پروژههای شما از نظر پوچپذیری در هنگام استفاده از Kotlin CodeGen سختگیرانهتر هستند. در Kotlin CodeGen، پوچ بودن آرگومان های نوع مهم است، در حالی که در جاوا این امر بیشتر نادیده گرفته می شود. به عنوان مثال، فرض کنید یک «جریان» دارید
- مصنوع جدید برای پلاگین Room Gradle با شناسه
androidx.room
به اتاق اضافه شده است، که مشکلات مختلف موجود در اتاق را در رابطه با داشتن ورودی و خروجی طرحواره ها از طریق گزینه های پردازشگر حاشیه نویسی Gradle حل می کند. برای جزئیات بیشتر، به یادداشتهای انتشار اتاق نسخه 2.6.0-alpha02 مراجعه کنید. - کلاسهای ارزش در موجودیتهای اتاق اکنون برای KSP پشتیبانی میشوند. ( 4194095 )
- انواع بازگشت نقشه تو در تو در توابع DAO اکنون در Room پشتیبانی می شوند. ( I13f48 , 203008711 )
نسخه 2.6.0-rc01
20 سپتامبر 2023
androidx.room:room-*:2.6.0-rc01
منتشر شد. نسخه 2.6.0-rc01 حاوی این commit ها است.
نسخه 2.6.0-beta01
23 آگوست 2023
androidx.room:room-*:2.6.0-beta01
منتشر شد. نسخه 2.6.0-beta01 حاوی این تعهدات است.
رفع اشکال
- رسیدگی به استثنای مورد خاص
SQLite
در حین upsert که وقتی استثنای2067 SQLITE_CONSTRAINT_UNIQUE
در حین upsert پرتاب میشود، upsert باید بهروزرسانی را انجام دهد. ( If2849 , b/243039555 )
نسخه 2.6.0-alpha03
9 آگوست 2023
androidx.room:room-*:2.6.0-alpha03
منتشر شد. نسخه 2.6.0-alpha03 حاوی این commit ها است.
ویژگی های جدید
تغییرات API
- یک نوع حاشیه نویسی جدید به نام
@MapColumn
به جای@MapInfo
ایجاد شده است که اکنون منسوخ شده است. برای نام هر ستون (keyColumnName
،valueColumnName
، یا هر دو) ارائه شده در یک حاشیه نویسی@MapInfo
، باید یک حاشیه نویسی@MapColumn
را فقط باcolumnName
اعلام کنید و از حاشیه نویسی بر روی آرگومان نوع خاصی که به آن ارجاع داده شده است (کلید یا مقدار Map) در تابع بازگشتی DAO استفاده کنید. دلیل آن این است که حاشیه نویسی@MapColumn
به جای استفاده از خود تابع مانند@MapInfo
، مستقیماً در آرگومان نوع در نوع بازگشتی یک تابع DAO استفاده می شود. برای اطلاعات بیشتر، لطفاً به مستندات@MapColumn
مراجعه کنید. ( Ib0305 , b/203008711 ) - فایل های API به روز شده برای حاشیه نویسی حذف سازگاری ( I8e87a , b/287516207 )
- APIهای افزونه Room Gradle بهروزرسانی شدهاند تا همیشه به پیکربندیهای مختلف نیاز نداشته باشند. این بدان معناست که افزونه میتواند یک مکان سراسری برای همه انواع بدون ایجاد دایرکتوریهای متعدد بپذیرد، مهاجرتهای نرمتری را امکانپذیر میکند، اما همچنین به اندازه کافی انعطافپذیر است تا به صورت دستی طعمها را پیکربندی کند یا طرحوارههای نوع را بسازد در حالی که همچنان مزایای افزونه را حفظ میکند (ساختهای قابل تکرار و ذخیرهسازی). ( I09d6f , b/278266663 )
رفع اشکال
- رفع آسیب پذیری احتمالی نشت حافظه در
QueryInterceptorStatement
. ( I193d1 ) - رفع رفتار نادرست در تابع
QueryInterceptorDatabase execSQL()
. ( Iefdc8 )
نسخه 2.6.0-alpha02
21 ژوئن 2023
androidx.room:room-*:2.6.0-alpha02
منتشر شد. نسخه 2.6.0-alpha02 حاوی این commit ها است.
پلاگین Room Gradle
این نسخه جدید حاوی مصنوع جدیدی برای پلاگین Room Gradle با شناسه androidx.room
است که مسائل مختلف موجود در اتاق را در رابطه با داشتن ورودی و خروجی طرحواره ها از طریق گزینه های پردازشگر حاشیه نویسی Gradle حل می کند. پلاگین Room Gradle پروژه را به گونهای پیکربندی میکند که طرحوارههای تولید شده که برای انتقال خودکار مصرف میشوند و خروجی وظایف کامپایل هستند، به درستی پیکربندی شوند تا ساختهای قابل تکرار و ذخیرهسازی شوند. این افزونه یک DSL را برای پیکربندی مکان طرح پایه ارائه می دهد:
room {
schemaDirectory("$projectDir/schemas/")
}
سپس این افزونه کامپایلر Room و وظایف کامپایل مختلف و باطنهای آن (javac، KAPT، KSP) را برای خروجی فایلهای طرحواره در پوشههای طعمدار، یعنی schemas/flavorOneDebug/com.package.MyDatabase/1.json
پیکربندی میکند. طبق معمول، این فایلها وارد مخزن میشوند تا برای اعتبارسنجی و انتقال خودکار استفاده شوند. پس از مهاجرت به استفاده از افزونه به جای گزینههای پردازشگر حاشیهنویسی، فایلهای طرحواره موجود باید در فهرستهای طعم ایجاد شده توسط افزونه کپی شوند، این یک عملیات انتقال یک بار است که باید به صورت دستی انجام شود. مستندات طرحواره در developers.android.com پس از دریافت بازخورد و پایدار ماندن افزونه در آینده بهروزرسانی میشود، بنابراین لطفاً آن را امتحان کنید.
تغییرات API
-
RoomDatabase.QueryCallback
به عنوان یک رابط کاربردی برای اجازه استفاده از تبدیل SAM تعریف شده است. ( Iab8ea , b/281008549 )
رفع اشکال
- حل مشکلی که هنگام نمونه سازی پایگاه داده در Robolectric پس از انتقال منابع Room از جاوا به Kotlin ایجاد می شود. ( Ic053c , b/274924903 )
نسخه 2.6.0-alpha01
22 مارس 2023
androidx.room:room-*:2.6.0-alpha01
منتشر شد. نسخه 2.6.0-alpha01 حاوی این commit ها است.
ویژگی های جدید
- پشتیبانی از کلاس های ارزش در Room for KSP. Room اکنون میتواند از کلاسهای ارزش در Entities پشتیبانی کند. ( 4194095 )
- تولید کد Kotlin (یا "Kotlin CodeGen") اکنون می تواند در اتاق فعال شود ( 4297ec0 ). برای روشن کردن Kotlin CodeGen در اتاق، نام گزینه
room.generateKotlin
را به گزینه های پردازنده خود برای KSP اضافه کنید. برای جزئیات بیشتر در مورد نحوه انتقال گزینه های پردازنده برای KSP، به مستندات KSP مراجعه کنید.
توجه: هنگام استفاده از Kotlin CodeGen، مهم است که توجه داشته باشید که محدودیتهای اضافی اضافه شده است. ویژگیهای انتزاعی بهعنوان دریافتکننده DAO یا پرسوجوهای DAO در Kotlin CodeGen غیرمجاز هستند، و در عوض انتظار میرود که بهعنوان توابع بازنویسی شوند تا از این تصور غلط مبنی بر اینکه مقدار ویژگی تغییرناپذیر است و یک نتیجه ذخیره شده ثابت دارد، جلوگیری شود. محدودیت دیگری که اضافه شده است این است که انواع بازگشت مجموعه Nullable دیگر در Room for Kotlin CodeGen مجاز نیستند.
هشدار: ممکن است متوجه شوید که پروژههای شما از نظر پوچپذیری در هنگام استفاده از Kotlin CodeGen سختگیرانهتر هستند. در Kotlin CodeGen، پوچ بودن آرگومان های نوع مهم است، در حالی که در جاوا این امر بیشتر نادیده گرفته می شود. به عنوان مثال، فرض کنید یک «جریان» دارید
تغییرات API
- محافظت در برابر استفاده بیمعنی از مجموعههای باطل در انواع برگشتی روش DAO. ( I777dc , b/253271782 , b/259426907 )
- برای ایجاد جریانی که تغییرات ردیاب عدم اعتبار را منتشر می کند، یک API اضافه کنید. API برای ایجاد جریان هایی که نیاز به واکنش به تغییرات پایگاه داده دارند مفید است. ( I8c790 , b/252899305 )
رفع اشکال
- خصوصیات انتزاعی را بهعنوان گیرندههای DAO یا پرسوجوهای DAO در کدژن Kotlin مجاز نکنید، در عوض آنها باید بهعنوان توابع بازنویسی شوند تا از این تصور غلط مبنی بر اینکه مقدار ویژگی تغییرناپذیر است و یک نتیجه ذخیره شده ثابت دارد، جلوگیری شود. ( If6a13 , b/127483380 , b/257967987 )
نسخه 2.5.2
نسخه 2.5.2
21 ژوئن 2023
androidx.room:room-*:2.5.2
منتشر شد. نسخه 2.5.2 حاوی این commit ها است.
رفع اشکال
- مشکل ناسازگاری را با kotlinx-metadata-jvm برطرف کنید. ( 386d5c )
- مشکلی را برطرف کنید که باعث میشود اتاق هنگام استفاده در تست روبولکتریک خطایی ایجاد کند. ( f79bea , b/274924903 )
نسخه 2.5.1
نسخه 2.5.1
22 مارس 2023
androidx.room:room-*:2.5.1
منتشر شد. نسخه 2.5.1 حاوی این commit ها است.
رفع اشکال
- اگر پایگاه داده از قبل باز است، از بررسی دایرکتوری والد پایگاه داده در
FrameworkSQLiteHelper
خودداری کنید. ( 5de86b8 ) - هنگام بررسی باز بودن پایگاه داده از یک چک
isOpenInternal
استفاده کنید. ( e91fb35 ) - مدیریت بهتر پرونده reentrant در
acquireTransactionThread()
Room
اکنون در دسترس است. ( 219f98b ). در طول یک تراکنش تعلیق، Room از یک رشته از مجری تراکنش استفاده میکند، یک حلقه رویداد را در آن راهاندازی میکند و عملیات تعلیق پایگاه داده را به آن ارسال میکند تا همه آنها در کوروتین تراکنش کپسوله شوند. معمولاً انتظار می رود که رشته تراکنش با موضوع شروع کننده تراکنش متفاوت باشد، اما در برخی موارد آنها یکسان هستند. برای رسیدگی به چنین موارد ورود مجدد،withTransaction()
بازسازی شده است تا دیگر به یک کار کنترلی متکی نباشد و در عوض بلوک تراکنش معلق را از داخلrunBlocking
در رشته تراکنش اجرا می کند.
نسخه 2.5.0
نسخه 2.5.0
22 فوریه 2023
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 شامل این commit ها است.
نسخه 2.5.0
11 ژانویه 2023
androidx.room:room-*:2.5.0
منتشر شد. نسخه 2.5.0 شامل این commit ها است.
تغییرات مهم از 2.4.0
- تمام منابع
room-runtime
از جاوا به کاتلین تبدیل شده اند. توجه داشته باشید که اگر کد شما در Kotlin باشد به دلیل تبدیل کتابخانه به Kotlin ممکن است با مشکلات ناسازگاری منبع مواجه شوید. به عنوان مثال، یک تغییر ناسازگار با منبع شناخته شده این است که درInvalidationTracker
اکنون بایدonInvalidate()
درObserver
اعلام کنید تا یک پارامتر از نوعSet
داشته باشید و نهMutableSet
. علاوه بر این، برخی از روشهای دریافتکننده به ویژگیهایی تبدیل شدند که به نحو دسترسی به ویژگی در فایلهای Kotlin نیاز دارند. لطفاً در صورت وجود هرگونه ناسازگاری قابل توجه، یک اشکال را ثبت کنید. - 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
androom-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
7 دسامبر 2022
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
9 نوامبر 2022
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
5 اکتبر 2022
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
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 aIllegalStateException
during an auto-migration foreign key constraint check. ( I328dd ) - Fix a Kotlin source incompatible change for getter / properties of
getOpenHelper
,getQueryExecutor
andgetTransactionExecutor
. ( Iad0ac )
Version 2.5.0-alpha02
1 ژوئن 2022
androidx.room:room-*:2.5.0-alpha02
is released. Version 2.5.0-alpha02 contains these commits.
ویژگی های جدید
- New
room-paging
artifactsroom-paging-rxjava2
,room-paging-rxjava3
androom-paging-guava
have been added for support in Room Paging.( 41a1d4 , b/203666906 ),( eb6098 , b/203666906 ),( 1b9ae4 , b/203666906 )
تغییرات 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 declareonInvalidate()
inObserver
to have a param of typeSet
and notMutableSet
. - 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
23 فوریه 2022
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 inroom-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
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 )
نسخه 2.4.2
نسخه 2.4.2
23 فوریه 2022
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 )
نسخه 2.4.1
نسخه 2.4.1
12 ژانویه 2022
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 )
نسخه 2.4.0
نسخه 2.4.0
15 دسامبر 2021
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 anAutoMigrationSpec
will be provided at runtime viaRoomDatabase.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 duringrunMigrationsAndValidate
. - Room-Paging Support :
androidx.room:room-paging
is released, providing native Paging 3.0 support for Room queries returningandroidx.paging.PagingSource
. - Relational Query Methods : Room now supports multimap return types
@Dao
methods, useful for JOIN statements. The supported types of multimaps areMap
,SparseArray
,LongSparseArray
, along with Guava'sImmutableMap
,ImmutableSetMultimap
andImmutableListMultimap
.
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
17 نوامبر 2021
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
13 اکتبر 2021
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 throughRoomDatabase.Builder
, so it can be overridden, instead ofDispatchers.IO
previously. ( Iae259 )
Version 2.4.0-alpha05
29 سپتامبر 2021
androidx.room:room-*:2.4.0-alpha05
is released. Version 2.4.0-alpha05 contains these commits.
ویژگی های جدید
- Added a built-in type converter for UUID . ( I671e8 , b/73132006 )
تغییرات 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. نمونه را ببینید:
@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 )
مشارکت خارجی
- Added new API to specify index order in @Index. Thanks to Nikita Zhelonkin. ( I033fc )
Version 2.4.0-alpha04
21 جولای 2021
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 areMap
along with Guava'sImmutableMap
,ImmutableSetMultimap
andImmutableListMultimap
.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'sObservable
, or coroutinesFlow
.
Room-Paging
androidx.room:room-paging
is released, providing native Paging 3.0 support for Room queries returningandroidx.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 theKey
withKey
being the first loaded item. This deviates from existing behavior whereLoadParams.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
16 ژوئن 2021
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 duringrunMigrationsAndValidate
.
رفع اشکال
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
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 anAutoMigrationSpec
will be provided at runtime viaRoomDatabase.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.
مشارکت خارجی
- Fix an issue in Room's
JournalMode.TRUNCATE
where theInvalidationTracker
callback was sometimes being invoked invalidly, too late, or not at all. Thanks toUli Bubenheimer | bubenheimer@users.noreply.github.com
( b/154040286 )
Version 2.4.0-alpha01
21 آوریل 2021
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
نسخه 2.3.0
نسخه 2.3.0
21 آوریل 2021
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 isandroidx.paging.PagingSource
.
Version 2.3.0-rc01
24 مارس 2021
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
10 مارس 2021
androidx.room:room-*:2.3.0-beta03
is released. Version 2.3.0-beta03 contains these commits.
ویژگی های جدید
- Added incremental compilation support for KSP. ( I031c1 , b/176453350 )
رفع اشکال
- 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 )
مشارکت خارجی
- 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
18 فوریه 2021
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 withksp
. For example, instead ofkapt 'androidx.room:room-compiler:2.3.0-beta02'
useksp '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
27 ژانویه 2021
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
16 دسامبر 2020
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 viaRoomDatabase.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 )
Known Issue
- 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 )
مشارکت خارجی
- 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
14 اکتبر 2020
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
inRoomDatabase.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
insideRoomDatabase
withCollections.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
22 جولای 2020
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
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 isandroidx.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 solutionroom.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 )
نسخه 2.2.6
نسخه 2.2.6
16 دسامبر 2020
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 )
نسخه 2.2.5
نسخه 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 )
نسخه 2.2.4
نسخه 2.2.4
19 فوریه 2020
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 )
نسخه 2.2.3
نسخه 2.2.3
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 )
نسخه 2.2.2
نسخه 2.2.2
20 نوامبر 2019
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 )
نسخه 2.2.1
نسخه 2.2.1
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 optionexpandProjection
turned ON. ( b/140759491 ) - Added a retry mechanism for handling the missing native library used for verifying queries during compile time.
نسخه 2.2.0
نسخه 2.2.0
9 اکتبر 2019
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 aRoomDatabase
given an already populated database file.createFromAsset()
is for when the pre-populated database file is in the assets folder of the APK, whilecreateFromFile()
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 propertydefaultValue
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 propertyassociateBy
, 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 typeList
orSet
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 propertytargetEntity
, 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 typeFlow<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 aChannel<T>
return type is an error, Room instead encourages you to useFlow
and then use the neighboring functions to convert theFlow
into aChannel
. 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 namedSongIdAndTitle
with only two fields. Then Room will rewrite the query toSELECT id, title FROM Song
such that the minimum set of columns to satisfy the return type are fetched. This essentially eliminates theCURSOR_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
5 سپتامبر 2019
androidx.room:room:2.2.0-rc01
is released. commit های موجود در این نسخه را می توانید در اینجا بیابید.
No public changes since Room 2.2.0-beta01
.
Version 2.2.0-beta01
22 آگوست 2019
androidx.room:room-*:2.2.0-beta01
is released. commit های موجود در این نسخه را می توانید در اینجا بیابید.
رفع اشکال
- 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
7 آگوست 2019
androidx.room:room-*:2.2.0-alpha02
is released. commit های موجود در این نسخه را می توانید در اینجا بیابید.
ویژگی های جدید
- Coroutines Flow :
@Query
DAO methods can now be of return typeFlow<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 aChannel<T>
return type is an error, Room instead encourages you to useFlow
and then use the neighboring functions to convert theFlow
into aChannel
. 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 namedSongIdAndTitle
with only two fields. Then Room will rewrite the query toSELECT id, title FROM Song
such that the minimum set of columns to satisfy the return type are fetched. This essentially eliminates theCURSOR_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 toRoomDatabase.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 aByteBuffer
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
10 جولای 2019
ویژگی های جدید
- Pre-packaged Database : Two new APIs in
RoomDatabase.Builder
are now available for creating aRoomDatabase
given an already populated database file.createFromAsset()
is for when the pre-populated database file is in the assets folder of the APK, whilecreateFromFile()
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 propertydefaultValue
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/64088772Note: 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 propertyassociateBy
, 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 typeList
orSet
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 propertytargetEntity
, 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
نسخه 2.1.0
نسخه 2.1.0
13 ژوئن 2019
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 functionRoomDatabase.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
containingINSERT
,DELETE
orUPDATE
statements, now support Rx return typesCompletable
,Single
,Maybe
, and Guava's return typeListenableFuture
, and they can also be suspend functions. -
enableMultiInstanceInvalidation
is a new API inRoomDatabase.Builder
to enable invalidation across multiple instances of RoomDatabase using the same database file. -
fallbackToDestructiveMigrationOnDowngrade
is a new API inRoomDatabase.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
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
7 مه 2019
androidx.room 2.1.0-beta01
is released with no changes from 2.1.0-alpha07. commit های موجود در این نسخه را می توانید در اینجا بیابید.
Version 2.1.0-alpha07
25 آوریل 2019
API / Behavior Changes
- The extension function
RoomDatabase.withTransaction
has been changed to no longer take a function block with aCoroutineScope
as receiver. This prevents skipping the additionalcoroutineScope { }
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
22 مارس 2019
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
13 مارس 2019
ویژگی های جدید
- 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 theroom-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 toroom-ktx
following the same naming as other androidx artifacts. -
beginTransaction
,setTransactionSuccessful
andendTransaction
inRoomDatabase
have been deprecated in favor ofrunInTransaction
and theroom-ktx
extension functionwithTransaction
.
رفع اشکال
- 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 withINSERT
,UPDATE
orDELETE
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 addingmaven { url "https://kotlin.bintray.com/kotlinx/" }
to your project repositories.
Version 2.1.0-alpha04
25 ژانویه 2019
ویژگی های جدید
- DAO methods annotated with
@Query
containingINSERT
,UPDATE
orDELETE
statements can now return async typesSingle
,Mayble
,Completable
andListenableFuture
. 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 asSingle
,Mayble
,Completable
,LiveData
orListenableFuture
. 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
andOnConflictStrategy.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()
andendTransaction()
. b/120854786
Version 2.1.0-alpha03
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 inFtsOptions
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 supportListenableFuture
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 anIN
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
30 اکتبر 2018
ویژگی های جدید
- 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
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 typesCompletable
,Single<T>
andMaybe<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 inRoomDatabase.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 inRoomDatabase.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
andmDatabase
inRoomDatabase
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
نسخه 2.0.0
نسخه 2.0.0
1 اکتبر 2018
androidx.room 2.0.0
is released with no changes from 2.0.0-rc01.
Version 2.0.0-rc01
20 سپتامبر 2018
androidx.room 2.0.0-rc01
is released with no changes from 2.0.0-beta01.
Version 2.0.0-beta01
2 جولای 2018
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"
}
نسخه 1.1.1
نسخه 1.1.1
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
نسخه 1.1.0
Version 1.1.0-beta3
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
5 آوریل 2018
رفع اشکال
Fixed a critical bug in
Room
RxSingle
andMaybe
implementations where it would recycle the query ahead of time, causing problems if you add more than 1 observer to the returnedSingle
orMaybe
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
21 مارس 2018
تغییرات API
- Based on API Review feedback,
@RawQuery
does not accept passing aString
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 ofvararg 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 theobservedEntities
property as long as the Pojo references to one or more entities via itsEmbedded
fields orRelation
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
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 inRoomDatabase.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 pagingalpha-4
or higher, and switch fromLivePagedListProvider
toLivePagedListBuilder
if you haven't already.
رفع اشکال
- Improved support for Kotlin Kapt types. b/69164099
- Order of fields do not invalidate schema anymore. b/64290754