Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting random crashes "Couldn't open db for writing (will try to read only) net.sqlcipher.database.SQLiteException: file is encrypted or is not a database: , while compiling: select count(*) from sqlite_master;" #290

Closed
RaduPopescu29 opened this issue Jan 18, 2017 · 4 comments

Comments

@RaduPopescu29
Copy link

I am using a ContentProvider with cipher.SQLiteOpenHelper and CursorLoaders to display data.
In the ContentProvider onCreate method I have SQLiteDatabase.loadLibs(getContext()). In the query method ot he ContentProvider i have
final SQLiteDatabase db = database.getReadableDatabase(password); which gives this error:

file is encrypted or is not a database: , while compiling: select count() from sqlite_master;
net.sqlcipher.database.SQLiteException: file is encrypted or is not a database: , while compiling: select count(
) from sqlite_master;

I am using a CursorLoader to query data. This does not happen all the time. With a fresh install everything works well, but when I reopen the app I constantly gets this crash.

I am using net.zetetic:android-database-sqlcipher:3.5.4@aar, Android version 6.0.1.

Any ideas?

@developernotes
Copy link
Member

Hello @RaduPopescu29,

Is this something you are able to reproduce within the SQLCipher for Android test suite? Are you certain you are always providing the correct password when you call getReadableDatabase(…);?

@SameerMB
Copy link

I did observed the same error on Samsung S7, Android 6.0.1.
Crash was on upgrading the app & it happened sometimes only.

@nkmadala
Copy link

I'm also observing the same issue randomly on HTC one, Android 6.0 with the following log. Any help or update on the issue please?

`

com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:797)
                                                 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:687)
02-15 10:21:22.105 15591-15591/? E/AndroidRuntime: FATAL EXCEPTION: main
                                                   Process: com.qumu.viewer, PID: 15591
                                                   net.sqlcipher.database.SQLiteException: file is encrypted or is not a database: , while compiling: select count(*) from sqlite_master;
                                                       at net.sqlcipher.database.SQLiteCompiledSql.native_compile(Native Method)
                                                       at net.sqlcipher.database.SQLiteCompiledSql.compile(SQLiteCompiledSql.java:91)
                                                       at net.sqlcipher.database.SQLiteCompiledSql.<init>(SQLiteCompiledSql.java:64)
                                                       at net.sqlcipher.database.SQLiteProgram.<init>(SQLiteProgram.java:83)
                                                       at net.sqlcipher.database.SQLiteQuery.<init>(SQLiteQuery.java:49)
                                                       at net.sqlcipher.database.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:42)
                                                       at net.sqlcipher.database.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1787)
                                                       at net.sqlcipher.database.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1752)
                                                       at net.sqlcipher.database.SQLiteDatabase.keyDatabase(SQLiteDatabase.java:2427)
                                                       at net.sqlcipher.database.SQLiteDatabase.openDatabaseInternal(SQLiteDatabase.java:2356)
                                                       at net.sqlcipher.database.SQLiteDatabase.openDatabase(SQLiteDatabase.java:1116)
                                                       at net.sqlcipher.database.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:1179)
                                                       at net.sqlcipher.database.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:162)
                                                       at net.sqlcipher.database.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:129)

`

@developernotes
Copy link
Member

Hi @SameerMB, @nkmadala,

Can you run the SQLCipher for Android test suite? Can you confirm that you are always providing the same password to getReadableDatabase(…);?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants