简体   繁体   English

使用SQLCipher库时出现不满意的链接错误

[英]Unsatisfied Link error while using SQLCipher library

I am using the SQLCipher Library for Android to Encrypt/Decrypt the DB file. 我正在使用Android的SQLCipher库来加密/解密DB文件。 I am following the exact steps that were discussed in the API to add the library. 我遵循API中讨论的添加库的确切步骤。

But I am getting a Unsatisfied link error when i run the project... Here's the logcat... 但是当我运行项目时,我收到一个不满意的链接错误...这是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. 请给我任何参考或提示。

java.lang.UnsatisfiedLinkError happens when the SQLCipher library was not initialized before using. java.lang.UnsatisfiedLinkError在使用之前未初始化SQLCipher库时发生。

To solve the problem, call SQLiteDatabase.loadLibs(this); 要解决此问题,请调用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");

你需要将.so文件添加到eclipse项目的libs / armae​​bi文件夹中并重建。

Could you share what version of SQLCipher for Android you are using? 你能分享一下你使用的Android版SQLCipher吗? We have recently released a new version of SQLCipher for Android with many changes. 我们最近发布了适用于Android的新版SQLCipher,并进行了许多更改。 If you are not currently up to date with the latest release you can get it here . 如果您目前不是最新版本,可以在此处获取。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM