Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No implementation found for void net.sqlcipher.database.SQLiteDatabase

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.

like image 541
Spider Avatar asked Oct 18 '15 17:10

Spider


2 Answers

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.

like image 166
CommonsWare Avatar answered Nov 02 '22 16:11

CommonsWare


Please confirm if use

SQLiteDatabase.loadLibs(CONTEXT);

where CONTEXT is the Android context

if using Fragment use getContext method else in Activity use applicationContext

like image 42
JABI Avatar answered Nov 02 '22 17:11

JABI