I'm trying to use sqlcipher lib to encrypt my database from already existing database but while accessing the old database(i.e opening the db) gives this exception:
02-27 13:12:21.231: E/AndroidRuntime(14687): FATAL EXCEPTION: main 02-27 13:12:21.231: E/AndroidRuntime(14687): java.lang.RuntimeException: Unable to start activity ComponentInfo{net.sqlcipher/example.SQLDemoActivity}: net.sqlcipher.database.SQLiteException: file is encrypted or is not a database 02-27 13:12:21.231: E/AndroidRuntime(14687): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2184) 02-27 13:12:21.231: E/AndroidRuntime(14687): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2211) 02-27 13:12:21.231: E/AndroidRuntime(14687): at android.app.ActivityThread.access$600(ActivityThread.java:149) 02-27 13:12:21.231: E/AndroidRuntime(14687): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1300) 02-27 13:12:21.231: E/AndroidRuntime(14687): at android.os.Handler.dispatchMessage(Handler.java:99) 02-27 13:12:21.231: E/AndroidRuntime(14687): at android.os.Looper.loop(Looper.java:153) 02-27 13:12:21.231: E/AndroidRuntime(14687): at android.app.ActivityThread.main(ActivityThread.java:4987) 02-27 13:12:21.231: E/AndroidRuntime(14687): at java.lang.reflect.Method.invokeNative(Native Method) 02-27 13:12:21.231: E/AndroidRuntime(14687): at java.lang.reflect.Method.invoke(Method.java:511) 02-27 13:12:21.231: E/AndroidRuntime(14687): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:821) 02-27 13:12:21.231: E/AndroidRuntime(14687): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584) 02-27 13:12:21.231: E/AndroidRuntime(14687): at dalvik.system.NativeStart.main(Native Method) 02-27 13:12:21.231: E/AndroidRuntime(14687): Caused by: net.sqlcipher.database.SQLiteException: file is encrypted or is not a database 02-27 13:12:21.231: E/AndroidRuntime(14687): at net.sqlcipher.database.SQLiteDatabase.native_setLocale(Native Method) 02-27 13:12:21.231: E/AndroidRuntime(14687): at net.sqlcipher.database.SQLiteDatabase.setLocale(SQLiteDatabase.java:2102) 02-27 13:12:21.231: E/AndroidRuntime(14687): at net.sqlcipher.database.SQLiteDatabase.(SQLiteDatabase.java:1968) 02-27 13:12:21.231: E/AndroidRuntime(14687): at net.sqlcipher.database.SQLiteDatabase.openDatabase(SQLiteDatabase.java:901) 02-27 13:12:21.231: E/AndroidRuntime(14687): at net.sqlcipher.database.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:944) 02-27 13:12:21.231: E/AndroidRuntime(14687): at net.sqlcipher.database.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:107) 02-27 13:12:21.231: E/AndroidRuntime(14687): at example.SQLDemoActivity.onCreate(SQLDemoActivity.java:42) 02-27 13:12:21.231: E/AndroidRuntime(14687): at android.app.Activity.performCreate(Activity.java:5020) 02-27 13:12:21.231: E/AndroidRuntime(14687): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080) 02-27 13:12:21.231: E/AndroidRuntime(14687): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148) 02-27 13:12:21.231: E/AndroidRuntime(14687): ... 11 more
since my old db is not encrypted so what should I set password in that case
I have tried with passing null in password string and also with "" but with no luck
reported issue to https://github.com/sqlcipher/android-database-sqlcipher/issues/124