android / architecture-components-samples

Samples for Android Architecture Components.
https://d.android.com/arch
Apache License 2.0
23.45k stars 8.28k forks source link

android.database.sqlite.SQLiteException: no such column (if device local is arabic) #695

Closed hossambusiness closed 4 years ago

hossambusiness commented 5 years ago

app is crashing in very specific case

if i install the app while the device local is English than no crash happen and everything is working as it should be.

if i change the device local to Arabic after the app being installed on English version than no crash too.

if i uninstall the app than change the device to local Arabic than install the app for first time, than the app crash and the logcat doesnt show where or which line, and the app crash even if i dont call the local database in splashscreen. Error log is :

android.database.sqlite.SQLiteException: no such column: ١٥٦٤٤١٠١٢٩٥٤٢ (code 1): , while compiling: DELETE FROM workspec WHERE state IN (2, 3, 5) AND (period_start_time + minimum_retention_duration) < ١٥٦٤٤١٠١٢٩٥٤٢ AND(SELECT COUNT()=0 FROM dependency WHERE prerequisite_id=id AND work_spec_id NOT IN (SELECT id FROM workspec WHERE state IN (2, 3, 5))) ################################################################# Error Code : 1 (SQLITE_ERROR) Caused By : SQL(query) error or missing database. (no such column: ١٥٦٤٤١٠١٢٩٥٤٢ (code 1): , while compiling: DELETE FROM workspec WHERE state IN (2, 3, 5) AND (period_start_time + minimum_retention_duration) < ١٥٦٤٤١٠١٢٩٥٤٢ AND(SELECT COUNT()=0 FROM dependency WHERE prerequisite_id=id AND work_spec_id NOT IN (SELECT id FROM workspec WHERE state IN (2, 3, 5)))) ################################################################# at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method) at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:1221) at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:695) at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588) at android.database.sqlite.SQLiteProgram.(SQLiteProgram.java:59) at android.database.sqlite.SQLiteStatement.(SQLiteStatement.java:31) at android.database.sqlite.SQLiteDatabase.executeSql(SQLiteDatabase.java:2213) at android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:2142) at android.arch.persistence.db.framework.FrameworkSQLiteDatabase.execSQL(FrameworkSQLiteDatabase.java:240) at androidx.work.impl.WorkDatabase$1.onOpen(WorkDatabase.java:114) at androidx.work.impl.WorkDatabase_Impl$1.onOpen(WorkDatabase_Impl.java:82) at android.arch.persistence.room.RoomOpenHelper.onOpen(RoomOpenHelper.java:101) at android.arch.persistence.db.framework.FrameworkSQLiteOpenHelper$OpenHelper.onOpen(FrameworkSQLiteOpenHelper.java:133) at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:349) at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:238) at android.arch.persistence.db.framework.FrameworkSQLiteOpenHelper$OpenHelper.getWritableSupportDatabase(FrameworkSQLiteOpenHelper.java:93) at android.arch.persistence.db.framework.FrameworkSQLiteOpenHelper.getWritableDatabase(FrameworkSQLiteOpenHelper.java:54) at android.arch.persistence.room.RoomDatabase.compileStatement(RoomDatabase.java:204) at android.arch.persistence.room.SharedSQLiteStatement.createNewStatement(SharedSQLiteStatement.java:65) at android.arch.persistence.room.SharedSQLiteStatement.getStmt(SharedSQLiteStatement.java:72) at android.arch.persistence.room.SharedSQLiteStatement.acquire(SharedSQLiteStatement.java:87) at androidx.work.impl.model.WorkSpecDao_Impl.resetScheduledState(WorkSpecDao_Impl.java:326) at androidx.work.impl.WorkManagerImpl.rescheduleEligibleWork(WorkManagerImpl.java:393) at androidx.work.impl.utils.ForceStopRunnable.run(ForceStopRunnable.java:66) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636) at java.lang.Thread.run(Thread.java:764)

after tracking the issue and it was in android.arch.work library implementation "android.arch.work:work-runtime:1.0.0-alpha01" it seems like it use local database and it use default local for query instead of English

Sanaebadi97 commented 5 years ago

hello , just upgrade ur database version ... is work for me

ianhanniballake commented 4 years ago

This doesn't seem to be an issue with the samples. You can file an issue against Room on the issue tracker if you're still having an issue.