I saw this error when trying to use sqlcipher in my project. I looked it up and found several people resolved it by adding SQLiteDatabase.loadLibs(); However, it says it's expecting an @NotNull Context context and I wasn't sure what it means. Has anyone resolved this issue? This and this are two of the sources I used.
The dependency in my gradle.build is compile 'net.zetetic:android-database-sqlcipher:3.3.1-1@aar' and since I have this, it means I don't have to manually move any files to my libs directory, right?
@Override
public void onCreate(SQLiteDatabase db) {
SQLiteDatabase.loadLibs();
db.execSQL(CREATE_SCRIPT);
}
Apologies in advance if these are basic questions.
However, it says it's expecting an @NotNull Context context and I wasn't sure what it means.
It means that loadLibs()
needs a Context
as a parameter.
Please confirm if use
SQLiteDatabase.loadLibs(CONTEXT);
where CONTEXT is the Android context
if using Fragment use getContext method else in Activity use applicationContext
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With