GreenDaoコンフィギュレーションマニュアル
プロジェクト・レベルの依存関係で1
配置 classpath 'org.greenrobot:greendao-gradle-plugin:3.2.2' // add plugin
モジュールレベルで2. [設定build.gradle
配置到build.gradle顶部
apply plugin: 'org.greenrobot.greendao' // apply plugin 步骤3
//配置到android模块下
greendao {
//数据库版本号,升级时修改
schemaVersion 1
//生成的DAO,DaoMaster和DaoSession的包路径。默认与表实体所在的包路径相同
daoPackage 'com.example.greendaodemo.db'
//生成源文件的路径。默认源文件目录是在build目录中的(build/generated/source/greendao)
targetGenDir 'src/main/java'
}
implementation 'org.greenrobot:greendao:3.2.2' // add library
implementation 'org.greenrobot:greendao-generator:3.2.2'
3.コンパイル
4. Beanオブジェクトを作成し、注釈ラベル(@Entity @Id)を追加
5.コンパイルメイク+プロジェクト