Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding .so files to Android project

I am trying to add SQLCipher to my project. I am able to link the jar files to the project but there is problem linking the .so files provided.

Due to that I am getting UnSatisfiedLinkError when i try to open the DB.

Can anyone please let me know the best possible way to add .so files to the project and get it running.

like image 315
Rahul Kalidindi Avatar asked Sep 12 '25 21:09

Rahul Kalidindi


1 Answers

In addition to jar files you need to include .so files. In my project I have:

jar files in project_root/libs/
.so files in project_root/libs/armeabi/

Also make sure that you have added the .jar files properly. Go to Project Properties -> Java Build Path -> Libraries tab make sure commonc-codec.jar, gueva-r09.jar, sqlcipher.jar are added there.

EDIT

1) Add a single sqlcipher.jar and a few .so’s to the application libs directory
2) Update the import path from android.database.sqlite.* to info.guardianproject.database.sqlite.* in any source files that reference it. The original android.database.Cursor can still be used unchanged.
3) Init the database in onCreate() and pass a variable argument to the open database method with a password*:

    SQLiteDatabase.loadLibs(this); //first init the db libraries with the context
    SQLiteOpenHelper.getWritableDatabase(“thisismysecret”):
like image 154
Caner Avatar answered Sep 15 '25 11:09

Caner