Android SQLiteCantOpenDatabaseException

Viewed 434

SQLite database can't be opened in the following Samsung device. In other devices it works fine.

Device name : Samsung A20
OS version : Android 9.0

The crash happens in the second line.

DatabaseHandler databaseHandler = new DatabaseHandler(context);
database = databaseHandler.getWritableDatabase();

The DatabaseHandler class mentioned above extends SQLiteOpenHelper.

Below is the log:

android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 1806 SQLITE_CANTOPEN_EACCES[1806]): Could not open database
    at android.database.sqlite.SQLiteConnection.nativeOpen(Native Method)
    at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:284)
    at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:215)
    at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:705)
    at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:272)
    at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:239)
    at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:1292)
    at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:1247)
    at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:903)
    at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:893)
    at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:355)
    at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:298)
    at androidx.sqlite.db.framework.FrameworkSQLiteOpenHelper$OpenHelper.getWritableSupportDatabase(FrameworkSQLiteOpenHelper.java:92)
    at androidx.sqlite.db.framework.FrameworkSQLiteOpenHelper.getWritableDatabase(FrameworkSQLiteOpenHelper.java:53)
    at androidx.room.RoomDatabase.beginTransaction(RoomDatabase.java:328)
    at androidx.work.impl.utils.ForceStopRunnable.cleanUp(ForceStopRunnable.java:135)
    at androidx.work.impl.utils.ForceStopRunnable.run(ForceStopRunnable.java:79)
    at androidx.work.impl.utils.SerialExecutor$Task.run(SerialExecutor.java:91)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
    at java.lang.Thread.run(Thread.java:764)
0 Answers
Related