plugins { id 'com.android.library' id 'org.greenrobot.greendao' // apply plugin } android { namespace 'com.android' compileSdk 34 defaultConfig { minSdk 21 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" consumerProguardFiles "consumer-rules.pro" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } } greendao { //指定数据库schema版本号,迁移等操作会用到 schemaVersion 10 //DaoSession、DaoMaster以及所有实体类的dao生成的目录,默认为你的entity所在的包名 //daoPackage 包名 daoPackage 'com.android.database' //这就是我们上面说到的自定义生成数据库文件的目录了,可以将生成的文件放到我们的java目录中,而不是build中,这样就不用额外的设置资源目录了 //工程路径 // targetGenDir 'src/main/java' } dependencies { implementation 'androidx.appcompat:appcompat:1.7.0' implementation 'com.google.android.material:material:1.12.0' testImplementation 'junit:junit:4.13.2' androidTestImplementation 'androidx.test.ext:junit:1.2.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1' // // http implementation 'com.squareup.okhttp3:okhttp:3.10.0' implementation 'com.squareup.retrofit2:converter-gson:2.3.0' implementation 'com.squareup.retrofit2:retrofit:2.3.0' implementation 'com.squareup.retrofit2:converter-scalars:2.3.0' //数据库 implementation 'org.greenrobot:greendao:3.3.0' //消息组件 implementation 'org.greenrobot:eventbus:3.1.1' }