Browse Source

1.1.0.6版本更新。

20241218TB223FC(测试jar包)
wangwanlei 8 months ago
parent
commit
dc528478ec
1 changed files with 30 additions and 5 deletions
  1. 30
    5
      app/build.gradle.kts

+ 30
- 5
app/build.gradle.kts View File

17
         applicationId = "com.xhkjedu.manageapp"
17
         applicationId = "com.xhkjedu.manageapp"
18
         minSdk = 24
18
         minSdk = 24
19
         targetSdk = 30
19
         targetSdk = 30
20
-        versionCode = 6
21
-        versionName = "1.0.5"
20
+        versionCode = 7
21
+        versionName = "1.0.6"
22
 
22
 
23
         testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
23
         testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
24
         vectorDrawables {
24
         vectorDrawables {
95
         return dateFormat.format(Date())
95
         return dateFormat.format(Date())
96
     }
96
     }
97
 
97
 
98
-    android.applicationVariants.all {variant->
98
+  /*  android.applicationVariants.all {variant->
99
        variant.outputs.all {output->
99
        variant.outputs.all {output->
100
            val versionName = variant.versionName
100
            val versionName = variant.versionName
101
            val versionCode = variant.versionCode
101
            val versionCode = variant.versionCode
102
            val variantName = variant.name
102
            val variantName = variant.name
103
            val apkName = "Manage_App-$variantName-$versionName-$versionCode-${releaseTime()}.apk"
103
            val apkName = "Manage_App-$variantName-$versionName-$versionCode-${releaseTime()}.apk"
104
-           output.outputFile.renameTo(File(output.outputFile.parentFile,apkName))
104
+          *//* output.outputFile.renameTo(File(output.outputFile.parentFile,apkName))*//*
105
+           val outputImpl = output as com.android.build.gradle.internal.api.BaseVariantOutputImpl
106
+           outputImpl.outputFileName=apkName
107
+           true
105
        }
108
        }
106
-    }
109
+    }*/
110
+    applicationVariants.all(
111
+        object : Action<com.android.build.gradle.api.ApplicationVariant> {
112
+            override fun execute(variant: com.android.build.gradle.api.ApplicationVariant) {
113
+                println("variant: $variant")
114
+                variant.outputs.all(
115
+                    object : Action<com.android.build.gradle.api.BaseVariantOutput> {
116
+                        override fun execute(
117
+                            output: com.android.build.gradle.api.BaseVariantOutput
118
+                        ) {
119
+                            val versionName = variant.versionName
120
+                            val versionCode = variant.versionCode
121
+                            val variantName = variant.name
122
+                            val outputImpl = output as com.android.build.gradle.internal.api.BaseVariantOutputImpl
123
+                            val fileName =  "Manage_App-$variantName-$versionName-$versionCode-${releaseTime()}.apk"
124
+                            println("output file name: $fileName")
125
+                            outputImpl.outputFileName = fileName
126
+                        }
127
+                    }
128
+                )
129
+            }
130
+        }
131
+    )
107
 }
132
 }
108
 
133
 
109
 dependencies {
134
 dependencies {

Loading…
Cancel
Save