SQLiteException happens onUpgrade


#1

Hello.

In Google Play console I regularly see “SQLiteException” after I database scheme changes (according to some reports, same error happens when Android OS updates).

Caused by: net.sqlcipher.database.SQLiteException:
at net.sqlcipher.database.SQLiteDatabase.native_execSQL (SQLiteDatabase.java)
at net.sqlcipher.database.SQLiteDatabase.execSQL (SQLiteDatabase.java:2265)
at de.greenrobot.dao.database.EncryptedDatabase.execSQL (EncryptedDatabase.java:36)
at com.teamwire.db.Database$1.onUpgrade (Database.java:73)
at de.greenrobot.dao.database.EncryptedDatabaseOpenHelper$Adapter.onUpgrade (EncryptedDatabaseOpenHelper.java:84)
at net.sqlcipher.database.SQLiteOpenHelper.getWritableDatabase (SQLiteOpenHelper.java:173)
at net.sqlcipher.database.SQLiteOpenHelper.getWritableDatabase (SQLiteOpenHelper.java:129)
at de.greenrobot.dao.database.EncryptedDatabaseOpenHelper.getWritableDatabase (EncryptedDatabaseOpenHelper.java:49)

I can’t reproduce it, SQL statements in “onUpgrade” function work fine for me. Any idea why it happens and how could I prevent it?

I’m using latest sqlcipher version - 3.5.9.

Thanks!


#2

Hello @iskugor

It is difficult to say without additional information. The JNI call to native_execSQL will throw an exception with a few states during execution in which we provide a message to the exception with further details. It would be best to narrow down the scenario and see if you can capture the exception output to further understand the cause.