SQLCipher on Android 5.0 X64 emulator crash


I have a problem on Eclipse Android 5.0 X64 emulator. When I use the openDataBases was crash. but on Eclipse Android 5.0 X86 or early version were not happen. can anyone help? Thanks a lot.

my code:
net.sqlcipher.database.SQLiteDatabase.openDatabase(dbPath, PASSWORD, null, SQLiteDatabase.OPEN_READONLY);

error messages:
CREATE TABLE android_metadata failed
Failed to setLocale() when constructing, closing the database
net.sqlcipher.database.SQLiteException: attempt to write a readonly database
at net.sqlcipher.database.SQLiteDatabase.native_setLocale(Native Method)
at net.sqlcipher.database.SQLiteDatabase.setLocale(SQLiteDatabase.java:2098)
at net.sqlcipher.database.SQLiteDatabase.(SQLiteDatabase.java:1964)
at net.sqlcipher.database.SQLiteDatabase.openDatabase(SQLiteDatabase.java:881)
at net.sqlcipher.database.SQLiteDatabase.openDatabase(SQLiteDatabase.java:936)


Hello @forever

I am looking into the issue, however at this time the Android 21 Intel x86 Atom_64 system image fails to launch for me. We will provide additional feedback as we work through this. Thanks


hello @developernotes did u find chance to fix this ?


Hello @forever and @vinay_kumar,

I just verified the SQLCipher for Android test suite runs successfully using the Android platform 21 Intel Atom x86_64 emulator, which now includes a test for opening a database using the SQLiteDatabase.OPEN_READONLY flag. Could you please try running the suite yourself? Thanks!


Hi Sir.

still Im getting the same error, android.database.sqlite.SQLiteException: not an error (code 0): Could not open the database in read/write mode.

is there any solution for this error…?

my database store in sdcard… and databse file is exist in sdcard…

FYI, I see this issue on Lenovo A7000-a, Lollipop device. Please help on this.


@chetan1011 that is a different problem, discussed at https://github.com/sqlcipher/android-database-sqlcipher/issues/139 and Roots of the problem - SQLiteException: not an error.


FYI the same problem (crash with net.sqlcipher.database.SQLiteException: attempt to write a readonly database) is also reported in https://github.com/sqlcipher/android-database-sqlcipher/issues/161.


According to the documentation in http://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html, and in the Javadoc as well, it is possible for SQLiteDatabase.openDatabase() to throw a SQLiteException if it cannot open the database any reason. Please add the code to catch and handle the exception in your application code.