首页 > 学院 > 开发设计 > 正文

GreeDao 3.0 集成

2019-11-09 13:46:53
字体:
来源:转载
供稿:网友

由于GreeDao 3.0 改变较大,以为仅以个人经验做点分享;

首先  官网是学习的第一手资料: 点击打开官网

接下来 我们看看如何集成GreeDao 到我们的项目 以AS为例1.添加依赖包:
dependencies {    compile 'org.greenrobot:greendao:3.0.1'}2.添加编译工具 
buildscript {    repositories {        mavenCentral()    }    dependencies {        classpath 'org.greenrobot:greendao-gradle-plugin:3.0.0'    }}
并且在 app  build.grale  顶部添加
apply plugin: 'org.greenrobot.greendao'3.添加 数据库基本配置
greendao{    schemaVersion 1 //数据库版本    daoPackage 'com.netease.study.io.orm' //生成Dao文件的目录    targetGenDir 'src/main/java'//获取 bean 文件的目录}4.最后 点击编译  就会在  “daoPackage” 对应的目录下生成各类Dao文件,当然 前提是你有需要编译的 Bean5.到此为止我们就已经集成了GreeAo了
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表