plugins { id 'com.android.application' id 'kotlin-android' id 'kotlin-kapt' } def androidConfig = rootProject.ext.android android { compileSdk androidConfig.compile_sdk_version buildToolsVersion androidConfig.build_tools_version defaultConfig { applicationId androidConfig.applicationId minSdk androidConfig.min_sdk_version targetSdk androidConfig.target_sdk_version versionCode androidConfig.version_code versionName androidConfig.version_name testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } /*构建类型: 定义Gradle在构建阶段和打包应用时使用的某些属性*/ buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } //配置产品变种 与 构建变体 //flavorDimensions :变种维度 // flavorDimensions "version" // productFlavors{ //产品变种 // demo{ // dimension "version" // //applicationId后追加 .demo 也可以重新定义applicationId 属性 // applicationIdSuffix ".demo" // versionNameSuffix "-demo" // } // full { // dimension "version" // applicationIdSuffix ".full" // versionNameSuffix '-full' // } // } //变体过滤器 // variantFilter { variant -> // def names = variant.flavors*.name // if (name.contains("demo")){ // setIgnore(true) // } // } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } kotlinOptions { jvmTarget = '1.8' } buildFeatures { viewBinding true dataBinding true } } dependencies { implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation project(path: ':lib:common') rootProject.ext.dependencies_required.each{ k, v -> implementation v} testImplementation rootProject.ext.dependencies_testImplementation.junit rootProject.ext.dependencies_androidTestImplementation.each{ k,v -> androidTestImplementation v} // kapt rootProject.ext.dependencies_kapt.lifecycle_compiler def lifecycle_version = "2.5.0-alpha02" def arch_version = "2.1.0" // // // ViewModel // implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version" // // ViewModel utilities for Compose // implementation "androidx.lifecycle:lifecycle-viewmodel-compose:$lifecycle_version" // // LiveData // implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version" // // Lifecycles only (without ViewModel or LiveData) // implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version" // // // Saved state module for ViewModel // implementation "androidx.lifecycle:lifecycle-viewmodel-savedstate:$lifecycle_version" // // // Annotation processor //// kapt "androidx.lifecycle:lifecycle-compiler:$lifecycle_version" // // alternately - if using Java8, use the following instead of lifecycle-compiler // implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version" // // optional - helpers for implementing LifecycleOwner in a Service // implementation "androidx.lifecycle:lifecycle-service:$lifecycle_version" // // // optional - ProcessLifecycleOwner provides a lifecycle for the whole application process // implementation "androidx.lifecycle:lifecycle-process:$lifecycle_version" // // // optional - ReactiveStreams support for LiveData // implementation "androidx.lifecycle:lifecycle-reactivestreams-ktx:$lifecycle_version" // // // optional - Test helpers for LiveData // testImplementation "androidx.arch.core:core-testing:$arch_version" }