UnsatisfiedLinkError при использовании libstlport_shared.so в проекте с SQLCipher

У меня есть приложение, которое имеет БД SQLite. Мне нужно сделать эту БД зашифрованной. Я посмотрел на SqlCipher для Android в качестве решения и посмотрел на следующую страницу.

SQLCipher

Следующая ветка имеет настройки, близкие к моему исходному приложению. Это класс с внутренним классом SqliteOpenHelper.

SQLCipher пример openhelper

Я скопировал 3 файла jar в папку lib моего проекта, как сказано в первом уроке.

Обще-codec.jar

гуавы-r09.jar

sqlcipher.jar

Я также скопировал файлы.so в папку в libs / armeabi

libdatabase_sqlcipher.so

libsqlcipher_android.so

libstlport_shared.so

Я думаю, что последний libstlport_shared.so вызывает проблемы, и я где-то читал, что я должен явно загрузить его?

Ниже приведен мой класс базы данных, который создает SQLCipher DB и таблицы.

import android.database.Cursor;
//import android.database.sqlite.SQLiteDatabase;
//import android.database.sqlite.SQLiteOpenHelper;
import net.sqlcipher.database.SQLiteDatabase;
import net.sqlcipher.database.SQLiteOpenHelper;

public class LoginValidate {

    private static final String TAG = LoginValidate.class.getSimpleName();

    // table transactions column names
    public static final String C_ID = BaseColumns._ID; // special for id
                                                        // internally in system
    public static final String C_TYPE = "type";
    public static final String C_COMPANY_ID = "companyid";
    public static final String C_PERSON_ID = "person";
    public static final String C_NAME = "name";
    public static final String C_TAG_ID = "tagid";
    public static final String C_STATUS = "status";
    public static final String C_TAG_SCAN_TIME = "tagscantime";
    public static final String C_TAG_SENTSERVER_TIME = "tagsentservertime";
    public static final String C_TRANSACTIONS_LATITUDE = "transactionslatitude";
    public static final String C_TRANSACTIONS_LONGITUDE = "transactionslongitude";
    public static final String C_DRIVER = "driver";



Context context;
    DBHelper dbhelper;
    NfcScannerApplication nfcscannerapplication;
    SharedPreferences appSharedPrefs;
    Editor prefsEditor;
    String versionName;

    public LoginValidate(Context context) {

        this.context = context;
        dbhelper = new DBHelper();
        nfcscannerapplication = (NfcScannerApplication) context
                .getApplicationContext();
        appSharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
        prefsEditor = appSharedPrefs.edit();



        SQLiteDatabase.loadLibs(context);

    }



public Cursor queryAllFromTransactions() {

        // open database
        SQLiteDatabase db = dbhelper.getReadableDatabase("12345");

        return db.query(DBHelper.TABLETRANSACTIONS, null, null, null, null,
                null, null);

    }


private class DBHelper extends SQLiteOpenHelper {

        // database name and version number
        public static final String DB_NAME = "carefreemobiledb.db";
        public static final int DB_VERSION = 55;

        // table names
        public static final String TABLETRANSACTIONS = "transactions";
        public static final String TABLECARER = "carer";
        public static final String TABLETRANSACTIONSMAP = "transactionsmap";
        public static final String TABLEPHONE = "phone";
        public static final String TABLECOMPANYID = "companyid";
        public static final String TABLEBACKGROUNDSERVICES = "backgroundservices";
        public static final String TABLEMESSAGE = "message";
        public static final String TABLEDUPLICATETRANSACTIONS = "tableduplicatetransactions";
        public static final String TABLECACHEDROTA = "tablecachedrota";
        public static final String TABLEUSERS = "users";
        public static final String TABLESTARTSTOPSHIFT = "startstopshift";
        public static final String TABLELOG = "log";

        public DBHelper() {
            super(context, DB_NAME, null, DB_VERSION);
        }

        @Override
        public void onCreate(SQLiteDatabase db) {



            Log.e(TAG, "SQLiteOpenHelper oncreate ");

            String sqlToCreateTransactionsTable = String
                    .format("create table %s ( %s INTEGER primary key, %s TEXT, %s TEXT, %s TEXT, %s TEXT, %s TEXT,"
                            + " %s TEXT, %s TEXT, %s INT, %s TEXT, %s TEXT, %s TEXT )",
                            TABLETRANSACTIONS, C_ID, C_TYPE, C_COMPANY_ID,
                            C_PERSON_ID, C_NAME, C_TAG_ID, C_STATUS,
                            C_TAG_SCAN_TIME, C_TAG_SENTSERVER_TIME,
                            C_TRANSACTIONS_LATITUDE, C_TRANSACTIONS_LONGITUDE,
                            C_DRIVER);

            db.execSQL(sqlToCreateTransactionsTable);
            Log.e(TAG, "oncreate " + sqlToCreateTransactionsTable);

}

Ниже мой logcat.

11-14 14:56:38.460: E/RR3ContentProvider(31791): inside RR3ContentProvider onCreate
11-14 14:56:38.510: E/art(31791): dlopen("/data/app-lib/com.carefreegroup.rr3-2/libstlport_shared.so", RTLD_LAZY) failed: dlopen failed: "/data/app-lib/com.carefreegroup.rr3-2/libstlport_shared.so" has unexpected e_machine: 3
11-14 14:56:38.510: E/AndroidRuntime(31791): FATAL EXCEPTION: main
11-14 14:56:38.510: E/AndroidRuntime(31791): Process: com.carefreegroup.rr3, PID: 31791
11-14 14:56:38.510: E/AndroidRuntime(31791): java.lang.UnsatisfiedLinkError: dlopen failed: "/data/app-lib/com.carefreegroup.rr3-2/libstlport_shared.so" has unexpected e_machine: 3
11-14 14:56:38.510: E/AndroidRuntime(31791):    at java.lang.Runtime.loadLibrary(Runtime.java:364)
11-14 14:56:38.510: E/AndroidRuntime(31791):    at java.lang.System.loadLibrary(System.java:533)
11-14 14:56:38.510: E/AndroidRuntime(31791):    at net.sqlcipher.database.SQLiteDatabase.loadLibs(SQLiteDatabase.java:118)
11-14 14:56:38.510: E/AndroidRuntime(31791):    at net.sqlcipher.database.SQLiteDatabase.loadLibs(SQLiteDatabase.java:113)
11-14 14:56:38.510: E/AndroidRuntime(31791):    at com.carefreegroup.rr3.LoginValidate.<init>(LoginValidate.java:189)
11-14 14:56:38.510: E/AndroidRuntime(31791):    at com.carefreegroup.rr3.NfcScannerApplication.onCreate(NfcScannerApplication.java:840)
11-14 14:56:38.510: E/AndroidRuntime(31791):    at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1020)
11-14 14:56:38.510: E/AndroidRuntime(31791):    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4924)
11-14 14:56:38.510: E/AndroidRuntime(31791):    at android.app.ActivityThread.access$1500(ActivityThread.java:153)
11-14 14:56:38.510: E/AndroidRuntime(31791):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1412)
11-14 14:56:38.510: E/AndroidRuntime(31791):    at android.os.Handler.dispatchMessage(Handler.java:102)
11-14 14:56:38.510: E/AndroidRuntime(31791):    at android.os.Looper.loop(Looper.java:157)
11-14 14:56:38.510: E/AndroidRuntime(31791):    at android.app.ActivityThread.main(ActivityThread.java:5633)
11-14 14:56:38.510: E/AndroidRuntime(31791):    at java.lang.reflect.Method.invoke(Native Method)
11-14 14:56:38.510: E/AndroidRuntime(31791):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:896)
11-14 14:56:38.510: E/AndroidRuntime(31791):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:712)

Кто-нибудь знает, почему я получаю unsatisfiedLinkError?

Я звоню

SQLiteDatabase.loadLibs(context);

перед вызовом в БД, но я думаю, что libstlport_shared.so не загружается должным образом.

заранее спасибо

Matt

0 ответов

Другие вопросы по тегам