在Android Studio项目中集成SQLCIPHER [英] Integrating SQLCIPHER in Android Studio Project
问题描述
我尝试在我的Android应用程序中集成SQLCipher,使用此链接和一些堆栈 - 溢出链接(但是它们已过时,与官方文档不同)。
I tried integrating SQLCipher in my Android Application, using this link and also some stack-overflow links(but they are out-dated and differs from official document).
所有步骤都正确执行,编码部分没有错误。但是最后,当我构建项目,我得到的错误消息是:
All the steps are correctly followed, and there is no error in the coding part. But at last, when I build the project, the error message I get is :
错误:(11,0)Gradle DSL方法找不到:'defaultConfig
可能的原因:
打开Gradle包装文件
应用Gradle插件
Error:(11, 0) Gradle DSL method not found: 'defaultConfig()' Possible causes:
任何人都可以帮助我摆脱这个错误。
Can anyone please help me to get rid of this error.
推荐答案
将此添加到您的应用程序的build.gradle中,它应该可以开箱即用:
add this to your build.gradle of your app and it should work out of the box:
dependencies {
compile 'net.zetetic:android-database-sqlcipher:3.5.2@aar'
...
}
在您的代码中,您应该加载'本地库',因为'aar'文件包含其中的一些。
In your code, you should load the 'native libraries' as this 'aar' file contains a few of them.
SQLiteDatabase.loadLibs(context);
注意,您应该使用 net.sqlcipher.database.SQLiteDatabase
而不是
android.database.sqlite.SQLiteDatabase
,就像一对其他SQLite类。
NOTE that you should use the net.sqlcipher.database.SQLiteDatabase
instead of android.database.sqlite.SQLiteDatabase
, just like a couple of other SQLite classes.
这篇关于在Android Studio项目中集成SQLCIPHER的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!