SQLiteException: file is not a database (code 26): , while compiling: SELECT COUNT(*) FROM sqlite_schema;

Hello Team,

I am using “implementation ‘net.zetetic:android-database-sqlcipher:3.5.9@aar’” dependency in my application

Now i am shifting to

'implementation ‘net.zetetic:sqlcipher-android:4.5.6@aar’

'implementation ‘androidx.sqlite:sqlite:2.2.0’

But app is getting crashed on “getWritableDatabase()” code.
I have checked password is getting correct in old and updated application.

DbHelper Code is below which extends SQLiteOpenHelper

private DbHelper(Context context) {
    super(context, databaseName, password, null, databaseVersion, 1, null, null, false);
}
public static synchronized SQLiteDatabase getDatabaseInstance(Context context) {

    mContext = context;
    try {

        if (instance == null) {
            instance = new DbHelper(context);
        }

        if (sqliteDatabase == null || !sqliteDatabase.isOpen()) {


            sqliteDatabase = instance.getWritableDatabase();
        }

        return sqliteDatabase;

    } catch (Exception e) {
        Logger.error(e.getMessage());
    }
    return null;
}

Error Message - android.database.sqlite.SQLiteException: file is not a database (code 26): , while compiling: SELECT COUNT(*) FROM sqlite_schema;

Hi @vicky_khurana,

SQLCipher 4.x will not open SQLCipher 3.x database files by default. We have some guidance on the options available to address this here: