由于需要修改源码,所以无法再通过compile 'de.greenrobot:greendao:2.0.0'来引入依赖库,下载GreenDao代码:
git clone https://github.com/greenrobot/greenDAO.git
只需要DaoCore部分即可,并且可以删除de.greenrobot.dao.test包和de.greenrobot.dao.InternalUnitTestDaoAccess.java
主要需要做如下修改:
1. android.database.sqlite.SQLiteDatabase 改为: net.sqlcipher.database.SQLiteDatabase
2. android.database.sqlite.SQLiteStatement 改为: net.sqlcipher.database.SQLiteStatement
3. android.database.DatabaseUtils 改为: net.sqlcipher.DatabaseUtils
4. de.greenrobot.dao.internal.FastCursor增加实现方法:
@Override
public void setExtras(Bundle extras) {
}
由于修改量不大,对于DaoGenerator部分暂时没有研究,以后有时间再做研究,本人目前使用的是AndroidAnnotations还没有升级到butterknife,所以本次还是暂时使用它。
项目的build.gradle修改如下:
classpath 'com.android.tools.build:gradle:1.5.0'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' // 新增
在module的buid.gradle修改内容如下:
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt' // 新增
android {
compileSdkVersion 23
b