I am using SugarORM in my android app, I have a countdown timer running which inserts data inside the Sqlite DB every second. While this is running, If I clear the Application data, the application crashes with ANR : SQLiteReadOnlyDatabaseException: attempt to write a readonly database. The other questions here in stackoverflow regarding this are of no help for SugarORM. I dont seem to find anything regarding this for SugarORM. Any Suggestions of what might happen..?

Initialising the sugarDB in application Class oncreate() as follows.

SugarContext.init(this);

and saving the DB object

try {
  utils.save();
 } catch(Exception e) {
  Log.e(TAG, "Exception -> "+e);
 }

the exception is

01-23 11:36:21.173 4861-4861/com.test.style E/SQLiteLog: (1032) statement aborts at 51: [INSERT OR REPLACE  INTO UTILS(CONFIG_VERSION_ID,IS_PERMANENT_BLOCK_TIMER_RUNNING_VIA_SELF_LOCK_DOWN,PERMISSION_FETCHFREQUENCY,CONFIGVERSION_ID,CUSTOMER_ID
01-23 11:36:21.174 4861-4861/com.test.style E/PermissionParameterUtils.class: save() :: exception : Did not save due to exception -> android.database.sqlite.SQLiteReadOnlyDatabaseException: attempt to write a readonly database (code 1032)
0

There are 0 best solutions below