hubowen пре 2 година
родитељ
комит
515a6b2e41

+ 6 - 7
app/build.gradle

@@ -4,15 +4,15 @@ plugins {
 }
 
 android {
-    compileSdk 32
-
+    compileSdk = rootProject.ext.compileSdkVersion
+    buildToolsVersion rootProject.ext.buildToolsVersion
 
     defaultConfig {
         applicationId "com.common.android.lib"
-        minSdk 21
-        targetSdk 32
-        versionCode 1
-        versionName "1.0"
+        minSdkVersion rootProject.ext.minSdkVersion
+        targetSdkVersion rootProject.ext.targetSdkVersion
+        versionCode rootProject.ext.versionCode
+        versionName rootProject.ext.versionName
 
         testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
     }
@@ -46,7 +46,6 @@ android {
 }
 
 
-
 dependencies {
 
     implementation project(':lib_common')

+ 24 - 0
build.gradle

@@ -12,6 +12,30 @@ plugins {
     id 'org.jetbrains.kotlin.android' version '1.7.0' apply false
 }
 
+project.ext {
+    // SDK and Tools
+    compileSdkVersion = 33
+    targetSdkVersion = 33
+    buildToolsVersion = "30.0.3"
+    minSdkVersion = 21
+    versionCode = 1
+    versionName = "1.0"
+
+    setDefaultConfig = {
+        extension ->
+            extension.compileSdkVersion project.ext.compileSdkVersion
+            extension.buildToolsVersion project.ext.buildToolsVersion
+            extension.defaultConfig {
+//                applicationId project.ext.applicationId
+                // 使用project.ext.minSdkVersion 代替minsdkVersion,直接使用minsdkVersion 引不到
+                minSdkVersion project.ext.minSdkVersion
+                targetSdkVersion project.ext.targetSdkVersion
+                versionCode project.ext.versionCode
+                versionName project.ext.versionName
+                testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
+            }
+    }
+}
 
 task clean(type: Delete) {
     delete rootProject.buildDir

+ 4 - 3
lib_ad_admob/build.gradle

@@ -4,11 +4,12 @@ plugins {
 }
 
 android {
-    compileSdk 32
+    compileSdk = rootProject.ext.compileSdkVersion
+    buildToolsVersion rootProject.ext.buildToolsVersion
 
     defaultConfig {
-        minSdk 21
-        targetSdk 32
+        minSdkVersion rootProject.ext.minSdkVersion
+        targetSdkVersion rootProject.ext.targetSdkVersion
 
         testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
         consumerProguardFiles "consumer-rules.pro"

+ 4 - 3
lib_ad_core/build.gradle

@@ -4,11 +4,12 @@ plugins {
 }
 
 android {
-    compileSdk 32
+    compileSdk = rootProject.ext.compileSdkVersion
+    buildToolsVersion rootProject.ext.buildToolsVersion
 
     defaultConfig {
-        minSdk 21
-        targetSdk 32
+        minSdkVersion rootProject.ext.minSdkVersion
+        targetSdkVersion rootProject.ext.targetSdkVersion
 
         testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
         consumerProguardFiles "consumer-rules.pro"

+ 4 - 3
lib_ad_csj/build.gradle

@@ -4,11 +4,12 @@ plugins {
 }
 
 android {
-    compileSdk 32
+    compileSdk = rootProject.ext.compileSdkVersion
+    buildToolsVersion rootProject.ext.buildToolsVersion
 
     defaultConfig {
-        minSdk 21
-        targetSdk 32
+        minSdkVersion rootProject.ext.minSdkVersion
+        targetSdkVersion rootProject.ext.targetSdkVersion
 
         testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
         consumerProguardFiles "consumer-rules.pro"

+ 4 - 3
lib_ad_gromore/build.gradle

@@ -4,11 +4,12 @@ plugins {
 }
 
 android {
-    compileSdk 32
+    compileSdk = rootProject.ext.compileSdkVersion
+    buildToolsVersion rootProject.ext.buildToolsVersion
 
     defaultConfig {
-        minSdk 21
-        targetSdk 32
+        minSdkVersion rootProject.ext.minSdkVersion
+        targetSdkVersion rootProject.ext.targetSdkVersion
 
         testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
         consumerProguardFiles "consumer-rules.pro"

+ 4 - 4
lib_common/build.gradle

@@ -4,11 +4,12 @@ plugins {
 }
 
 android {
-    compileSdk 32
+    compileSdk = rootProject.ext.compileSdkVersion
+    buildToolsVersion rootProject.ext.buildToolsVersion
 
     defaultConfig {
-        minSdk 21
-        targetSdk 32
+        minSdkVersion rootProject.ext.minSdkVersion
+        targetSdkVersion rootProject.ext.targetSdkVersion
 
         testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
         consumerProguardFiles "consumer-rules.pro"
@@ -35,7 +36,6 @@ android {
 }
 
 dependencies {
-
     api 'androidx.core:core-ktx:1.8.0'
     api 'androidx.appcompat:appcompat:1.4.2'
     api 'com.google.android.material:material:1.6.1'