jeudi 10 septembre 2015

Android couldn't find "libsqlcipher_android.so"

before writing this post, I looked around if anyone had my problem with the library SQLChiper. As per the documentation I have included the files Jar properly and the ZIP file in the assets folder . Now in the Activity, when initialize the database I get this error:

java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/my.app-2/base.apk"],
nativeLibraryDirectories=[/vendor/lib, /system/lib]]] couldn't find "libsqlcipher_android.so"

Helper class:

import android.content.Context;
import net.sqlcipher.database.SQLiteDatabase;
import net.sqlcipher.database.SQLiteOpenHelper;
import java.text.MessageFormat;

public class DbCrypt extends SQLiteOpenHelper {

private static final String DB_NAME = "database.db";
private static final int DB_VERSION = 1;

private static SQLiteDatabase db = null;


public DbCrypt(Context context) {
    super(context, DB_NAME, null, DB_VERSION);

}

@Override
public void onCreate(SQLiteDatabase db) {
    DbCrypt.db = db;



    ...


}

Activity

public class Add_category extends AppCompatActivity implements OnClickListener {

private Toolbar mToolbar;
private Button btnAddcat;
private ButtonRectangle btnAddField;
private TextView tvEmpty;
private ListView list;
private DbCrypt mDatabase;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.add_category);


    SQLiteDatabase.loadLibs(this);
    String pass = "9626";
    mDatabase = new DbCrypt(this);
...
}

I attach a pictureenter image description here

Aucun commentaire:

Enregistrer un commentaire