Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unsatisfied Link error while using SQLCipher library

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 am getting a Unsatisfied link error when i run the project... Here's the logcat...

11-15 13:12:08.482: ERROR/AndroidRuntime(340): java.lang.UnsatisfiedLinkError: dbopen
11-15 13:12:08.482: ERROR/AndroidRuntime(340):     at info.guardianproject.database.sqlcipher.SQLiteDatabase.dbopen(Native Method)
11-15 13:12:08.482: ERROR/AndroidRuntime(340):     at info.guardianproject.database.sqlcipher.SQLiteDatabase.<init>(SQLiteDatabase.java:1876)
11-15 13:12:08.482: ERROR/AndroidRuntime(340):     at info.guardianproject.database.sqlcipher.SQLiteDatabase.openDatabase(SQLiteDatabase.java:870)
11-15 13:12:08.482: ERROR/AndroidRuntime(340):     at info.guardianproject.database.sqlcipher.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:904)
11-15 13:12:08.482: ERROR/AndroidRuntime(340):     at info.guardianproject.database.sqlcipher.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:107)
11-15 13:12:08.482: ERROR/AndroidRuntime(340):     at com.myproject1.getInstance(AppData.java:60)

Please give me any reference or hint.

like image 757
Rahul Kalidindi Avatar asked Nov 15 '11 13:11

Rahul Kalidindi


3 Answers

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");
like image 90
segfault Avatar answered Sep 19 '22 17:09

segfault


you need to add the .so files into the libs/armaebi folder of your eclipse project and rebuild.

like image 36
samir Avatar answered Sep 20 '22 17:09

samir


Could you share what version of SQLCipher for Android you are using? We have recently released a new version of SQLCipher for Android with many changes. If you are not currently up to date with the latest release you can get it here.

like image 1
Nick Parker Avatar answered Sep 22 '22 17:09

Nick Parker