Unsatisfied Link error while using SQLCipher library

后端 未结 3 1673
旧时难觅i
旧时难觅i 2020-12-20 21:18

I am using the SQLCipher Library for Android to Encrypt/Decrypt the DB file. I am following the exact steps that were discussed in the API to add the library.

But I

3条回答
  •  南方客
    南方客 (楼主)
    2020-12-20 21:35

    java.lang.UnsatisfiedLinkError happens when the SQLCipher library was not initialized before using.

    To solve the problem, call SQLiteDatabase.loadLibs(this); before using.

    For example:

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    
        SQLiteDatabase.loadLibs(this);
    
        // Set up the window layout
        setContentView(R.layout.main);
    
        //instance of database adapter
        db = DBAdapter.getInstance(this);
    
        //load database
        db.load("password goes here");
    

提交回复
热议问题