Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android room database locked

I had been getting " android.database.sqlite.SQLiteDatabaseLockedException" exception from production when I had been using 3rd party non-thread safe sqlite libraries. I checked all the threads and connection closing, I made all instances singleton but I wasn't able to solve the problem (I haven't even reproduce case myself). Then I moved my orm to Room database which is completely thread safe. But I'm still getting the exactly same error from production. So isn't Room db thread safe and isn't it take care of concerns for conventional sqlite libraries as Google mentioned? Is there anybody who faces db locked error with Room?

like image 696
DiRiNoiD Avatar asked Mar 02 '26 17:03

DiRiNoiD


1 Answers

Please, check https://stackoverflow.com/a/63849367/3256989 . In short words, try to use enableMultiInstanceInvalidation() during building RoomDatabase.

like image 77
ultraon Avatar answered Mar 04 '26 09:03

ultraon



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!