将.so文件添加到Android项目中

Rah*_*rma 4 android sqlcipher

我正在尝试将 SQLCipher 添加到我的项目中。我可以将 jar 文件链接到项目,但链接提供的 .so 文件时出现问题。

因此,当我尝试打开数据库时,我收到 UnSatisfiedLinkError 。

谁能告诉我将 .so 文件添加到项目并使其运行的最佳方法。

Can*_*ner 5

除了 jar 文件之外,您还需要包含 .so 文件。在我的项目中我有:

\n\n
jar files in project_root/libs/\n.so files in project_root/libs/armeabi/\n
Run Code Online (Sandbox Code Playgroud)\n\n

另请确保您已正确添加 .jar 文件。转到Project Properties -> Java Build Path -> Libraries选项卡,确保在那里添加commonc-codec.jar, gueva-r09.jar, 。sqlcipher.jar

\n\n

编辑

\n\n
1) Add a single sqlcipher.jar and a few .so\xe2\x80\x99s to the application libs directory\n2) 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.\n3) Init the database in onCreate() and pass a variable argument to the open database method with a password*:\n\n    SQLiteDatabase.loadLibs(this); //first init the db libraries with the context\n    SQLiteOpenHelper.getWritableDatabase(\xe2\x80\x9cthisismysecret\xe2\x80\x9d):\n
Run Code Online (Sandbox Code Playgroud)\n