greenddao配置

http://blog.csdn.net/huangxiaoguo1/article/details/52916189

http://www.jianshu.com/p/5449656d56d2

http://www.jianshu.com/p/d61983df2341



引入greendao(3.2.0版本)

1、在project的build.gradle文件中

 buildscript {
    repositories {
        jcenter()

        //GREENDAO
        mavenCentral()

    }
    dependencies {

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files

        //GREENDAO
        classpath 'com.android.tools.build:gradle:2.3.0'
        classpath 'org.greenrobot:greendao-gradle-plugin:3.2.1'
        classpath 'com.jakewharton:butterknife-gradle-plugin:8.5.1'
    }
}

2、在app的build.gradle文件中

//greendao
apply plugin: 'org.greenrobot.greendao'


android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "test.jzg.com.orm"
        minSdkVersion 19
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    greendao {
        //数据库的schema版本,也可以理解为数据库版本号
        schemaVersion 1
        //设置DaoMaster、DaoSession、Dao包名,也就是要放置这些类的包的全路径。
        daoPackage 'test.jzg.com.orm.greendao'
        //设置DaoMaster、DaoSession、Dao目录
        targetGenDir 'src/main/java'
    }

}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.2.0'
    testCompile 'junit:junit:4.12'

	//greendao
    compile 'org.greenrobot:greendao:3.2.0'

    compile 'com.jakewharton:butterknife:8.5.1'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
}


你可能感兴趣的:(Android,SQLite)