Hi Sqlcipher team:
We recently got a crash issue on Android 7 with sqlcipher v5.3.6. The exception is throw when the app first call getWritableDatabase. The strange part is that: it happens after the app is installed and being played for one day or two days later. Once it happened, user cannot successfully launch app anymore. If user reinstalls the app, it works again (or use adb reinstall directly, no need to delete, which means database file is not corrupted), however the crash will happen one or two days later.
We initialize the SQLiteOpenHelper with null factory, so it suppose to return a new SQLiteCursor (SQLiteDirectCursorDriver.java) to CursorWrapper. How come mCursor inside CursorWrapper became null…?
Our application is built with multidex android platform 23 by Unity. We need your help with this critical issue. Thank you.
java.lang.RuntimeException: Unable to start activity ComponentInfo{MY_ACTIVITY}: java.lang.NullPointerException: Attempt to invoke interface method ‘boolean android.database.Cursor.moveToFirst()’ on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2711)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2772)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1515)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:241)
at android.app.ActivityThread.main(ActivityThread.java:6223)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Caused by: java.lang.NullPointerException: Attempt to invoke interface method ‘boolean android.database.Cursor.moveToFirst()’ on a null object reference
at android.database.CursorWrapper.moveToFirst(CursorWrapper.java:71)
at net.sqlcipher.database.SQLiteDatabase.keyDatabase(SQLiteDatabase.java:2488)
at net.sqlcipher.database.SQLiteDatabase.openDatabaseInternal(SQLiteDatabase.java:2415)
at net.sqlcipher.database.SQLiteDatabase.openDatabase(SQLiteDatabase.java:1149)
at net.sqlcipher.database.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:1212)
at net.sqlcipher.database.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:162)
at net.sqlcipher.database.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:129)
at MY_PACKAGE.StepEnctyptDatabase.getDatabase(StepEnctyptDatabase.java:123)
at MY_PACKAGE.StepEnctyptDatabase.getDbStatusItem(StepEnctyptDatabase.java:209)
at MY_PACKAGE.StepEnctyptDatabase.checkNeedMigration(StepEnctyptDatabase.java:183)
at MY_PACKAGE.StepEnctyptDatabase.getSharedDatabase(StepEnctyptDatabase.java:90)
at MY_PACKAGE.SWUnityExternalJavaPlugin.onCreate(SWUnityExternalJavaPlugin.java:134)
at android.app.Activity.performCreate(Activity.java:6705)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2664)
… 9 more