On Crashlytics, I see many Room exceptions with this message: "Make sure the Cursor is initialized correctly before accessing data from it". I cannot produce this error on my devices, and the error does not occur on a specific Android version or device model.
I cannot find anything about this error on Room. There are question for SQLLite and most of them are about problematic SQL queries which are written by hand.
Even this simple query has errors on customer devices.
@Query("SELECT * FROM UserAction WHERE UserAction.userId LIKE :userId " +
" ORDER BY last_update_time DESC")
public List<UserAction> allList(String usedId);
The exception is:
Fatal Exception: java.lang.IllegalStateException: Couldn't read row 1756, col 0 from CursorWindow. Make sure the Cursor is initialized correctly before accessing data from it. at android.database.CursorWindow.nativeGetString(CursorWindow.java) at android.database.CursorWindow.getString(CursorWindow.java:438) at android.database.AbstractWindowedCursor.getString(AbstractWindowedCursor.java:66)
The error occurs on generated code inside of while loop
while(_cursor.moveToNext()) {
final UserAction _item;
_item = new UserAction();
_item.userId = _cursor.getString(_cursorIndexOfUserId); //Exception here