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

Dear Team,

Currently, I am using v3.5.7 ‘net.zetetic:android-database-sqlcipher:3.5.7@aar’,
and when we update to the latest v4.13 ‘net.zetetic:android-database-sqlcipher:4.1.3@aar’

we are getting below exception while opening database through ContentProvider.
I have verified we are passing same database password.

I have test with Test Suite
where i have checkout Test suit with Library version3.5.8 and tried to update it with latest version 4.1.3
Here I have observed that it fails 7 test cases
for reference i have attached screenshot

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

Unable to create application com.qualys.android.agent.MainApplication: net.sqlcipher.database.SQLiteException: file is not a database: , while compiling: select count(*) from sqlite_master;
		android.app.ActivityThread.handleBindApplication(ActivityThread.java:5447)
		android.app.ActivityThread.-wrap2(ActivityThread.java)
		android.app.ActivityThread$H.handleMessage(ActivityThread.java:1558)
		android.os.Handler.dispatchMessage(Handler.java:102)
		android.os.Looper.loop(Looper.java:154)
		android.app.ActivityThread.main(ActivityThread.java:6165)
		java.lang.reflect.Method.invoke(Native Method)
		com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:888)
		com.android.internal.os.ZygoteInit.main(ZygoteInit.java:778)
Caused by: 
file is not a database: , while compiling: select count(*) from sqlite_master;
		net.sqlcipher.database.SQLiteCompiledSql.native_compile(Native Method)
		net.sqlcipher.database.SQLiteCompiledSql.compile(SQLiteCompiledSql.java:91)
		net.sqlcipher.database.SQLiteCompiledSql.<init>(SQLiteCompiledSql.java:64)
		net.sqlcipher.database.SQLiteProgram.<init>(SQLiteProgram.java:89)
		net.sqlcipher.database.SQLiteQuery.<init>(SQLiteQuery.java:48)
		net.sqlcipher.database.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:60)
		net.sqlcipher.database.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:2012)
		net.sqlcipher.database.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1898)
		net.sqlcipher.database.SQLiteDatabase.keyDatabase(SQLiteDatabase.java:2647)
		net.sqlcipher.database.SQLiteDatabase.openDatabaseInternal(SQLiteDatabase.java:2577)
		net.sqlcipher.database.SQLiteDatabase.openDatabase(SQLiteDatabase.java:1243)
		net.sqlcipher.database.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:1318)
		net.sqlcipher.database.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:166)
		net.sqlcipher.database.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:135)
		net.sqlcipher.database.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:131)
1 Like

Hi @gupta126

You should also update the test suite library from master, it has been updated to work with SQLCipher for Android 4.1.3.

Hi @developernotes,

But while updating the library in our we are getting an exception.

Hi @gupta126

Your exception is likely due to the change in the library file format due to a large number of security improvements. SQLCipher for Android 4.1.3 includes the major version update to SQLCipher Core 4.0, please review the upgrade documentation to SQLCipher 4 series here.

Would you try the upgrade approach and let us know your results?

A post was split to a new topic: Migrating Android Application from SQLCipher 3 to 4