7

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.

Sandip Armal Patil
  • 6,241
  • 21
  • 93
  • 160
Rahul Kalidindi
  • 4,666
  • 14
  • 56
  • 92

3 Answers3

15

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");
segfault
  • 5,759
  • 9
  • 45
  • 66
3

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

samir
  • 46
  • 1
1

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.

Nick Parker
  • 1,378
  • 1
  • 7
  • 10
  • I've experienced this exception using SQLCipher v2.0 RC4. .so files are included in project... – straya Mar 19 '12 at 22:38
  • ^ turns out it was yet another Eclipse bug causing this, whereby included libraries werent actually included. – straya Mar 20 '12 at 03:53
  • @straya After following setfault's advice, I may have run into the same issue with sqlcipher v2.1.1. It can't find "libraryName "stlport_shared" (id=830025040304)". How did you get around this? – stephen Feb 21 '13 at 05:17
  • turns out the libraries have to be in folder "prj/libs" (plural) not "prj/lib"...what a horrible dependency. – stephen Feb 21 '13 at 05:36