Unsatisfied Link error while using SQLCipher library

笑着哭i 提交于 2019-11-28 07:47:33

问题


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.


回答1:


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




回答2:


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");



回答3:


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.



来源:https://stackoverflow.com/questions/8136714/unsatisfied-link-error-while-using-sqlcipher-library

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!