1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- plugins {
- id 'com.android.application'
- id 'kotlin-android'
- }
- 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
- }
- }
-
- dependencies {
- implementation 'androidx.appcompat:appcompat:1.2.0'
- implementation 'com.google.android.material:material:1.3.0'
- implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
- implementation 'androidx.legacy:legacy-support-v4:1.0.0'
- rootProject.ext.dependencies_required.each{ k, v -> implementation v}
- testImplementation rootProject.ext.dependencies_testImplementation.junit
- rootProject.ext.dependencies_androidTestImplementation.each{ k,v -> androidTestImplementation v}
- }
|