我正在尝试将 SQLCipher 添加到我的项目中。我可以将 jar 文件链接到项目,但链接提供的 .so 文件时出现问题。
因此,当我尝试打开数据库时,我收到 UnSatisfiedLinkError 。
谁能告诉我将 .so 文件添加到项目并使其运行的最佳方法。
除了 jar 文件之外,您还需要包含 .so 文件。在我的项目中我有:
\n\njar files in project_root/libs/\n.so files in project_root/libs/armeabi/\nRun Code Online (Sandbox Code Playgroud)\n\n另请确保您已正确添加 .jar 文件。转到Project Properties -> Java Build Path -> Libraries选项卡,确保在那里添加commonc-codec.jar, gueva-r09.jar, 。sqlcipher.jar
编辑
\n\n1) 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):\nRun Code Online (Sandbox Code Playgroud)\n