Browse Source

1.修改打包包名

20241218TB223FC(测试jar包)
wangwanlei 8 months ago
parent
commit
4d744cd74d
1 changed files with 18 additions and 0 deletions
  1. 18
    0
      app/build.gradle.kts

+ 18
- 0
app/build.gradle.kts View File

@@ -1,5 +1,8 @@
1 1
 @file:Suppress("CAST_NEVER_SUCCEEDS")
2 2
 
3
+import java.text.SimpleDateFormat
4
+import java.util.Date
5
+
3 6
 @Suppress("DSL_SCOPE_VIOLATION") // TODO: Remove once KTIJ-19369 is fixed
4 7
 plugins {
5 8
     alias(libs.plugins.androidApplication)
@@ -83,6 +86,21 @@ android {
83 86
     lint {
84 87
         abortOnError=false
85 88
     }
89
+
90
+    fun releaseTime(): String {
91
+        val dateFormat = SimpleDateFormat("yyyyMMdd")
92
+        return dateFormat.format(Date())
93
+    }
94
+
95
+    android.applicationVariants.all {variant->
96
+       variant.outputs.all {output->
97
+           val versionName = variant.versionName
98
+           val versionCode = variant.versionCode
99
+           val variantName = variant.name
100
+           val apkName = "Manage_App-$variantName-$versionName-$versionCode-${releaseTime()}.apk"
101
+           output.outputFile.renameTo(File(output.outputFile.parentFile,apkName))
102
+       }
103
+    }
86 104
 }
87 105
 
88 106
 dependencies {

Loading…
Cancel
Save