Recently I've run into a problem connected with using SQLiteOpenHelper. Few users reported the error I can't reproduce:
android.database.sqlite.SQLiteDiskIOException: disk I/O error
at android.database.sqlite.SQLiteDatabase.native_setLocale(Native Method)
at android.database.sqlite.SQLiteDatabase.setLocale(SQLiteDatabase.java:1987)
at android.database.sqlite.SQLiteDatabase.<init>(SQLiteDatabase.java:1855)
at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:820)
at android.database.sqlite.SQLiteOpenHelper.getReadableDatabase(SQLiteOpenHelper.java:197)
My implementation goes:
public class SqliteDatabase extends SQLiteOpenHelper
{
public SqliteDatabase(Context context, String dbName, int dbVersion)
{
super(context, dbName, null, dbVersion);
this.context = context;
this.dbName = dbName;
this.dbVersion = dbVersion;
}
(...)
}
So nothing special here. The exception is thrown after getReadableDatabase() invocation, as visible in stack.
Note that this class is accesed by many threads, but the access is totally synchronized (locks + only one, the same class instance). The Application can be moved to sdcard (maybe that's the issue?).
Unfortunately I do not know on which device / Android version the problem occurs (platform: other in Google Play console), but after doing some googling I suspect it's Android v2.2.1.
Any ideas? I know that the problem is more-less common, but I have not found any solution yet...