From 666ccfdc9351e778b4c4e32a9802832e12c8c427 Mon Sep 17 00:00:00 2001 From: BlueMatthew Date: Tue, 20 Feb 2024 17:23:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=BC=96=E8=AF=91=E8=84=9A?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 33 ++++++++++++++------------------- mpmaster/build.gradle | 26 +++++++++++--------------- 2 files changed, 25 insertions(+), 34 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 233af29f..b648faa1 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -42,29 +42,10 @@ android { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - - android.applicationVariants.all { variant -> - variant.outputs.all { output -> - if (outputFileName.endsWith('.apk')) { - def fileName = "mpapp_v${defaultConfig.versionName}_rel_${new Date(System.currentTimeMillis()).format("yyyyMMdd")}.apk" - outputFileName = fileName - } - } - } } debug { jniDebuggable true testCoverageEnabled false - - android.applicationVariants.all { variant -> - variant.outputs.all { output -> - if (outputFileName.endsWith('.apk')) { - def fileName = "mpapp_v${defaultConfig.versionName}_${new Date(System.currentTimeMillis()).format("yyyyMMdd")}.apk" - outputFileName = fileName - } - } - } - } } @@ -84,6 +65,20 @@ android { version '3.22.1' } } + + android.applicationVariants.all { variant -> + variant.outputs.all { output -> + if (outputFileName.endsWith('.apk')) { + def buildTypeFlag = "dbg" + if(variant.buildType.name.equals('release')) { + buildTypeFlag = "rel" + } + def fileName = "mpapp_v${defaultConfig.versionName}_${buildTypeFlag}_${new Date(System.currentTimeMillis()).format("yyyyMMdd")}.apk" + outputFileName = fileName + } + } + } + buildFeatures { viewBinding true } diff --git a/mpmaster/build.gradle b/mpmaster/build.gradle index 9f31840d..e52958de 100644 --- a/mpmaster/build.gradle +++ b/mpmaster/build.gradle @@ -28,25 +28,21 @@ android { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - - android.applicationVariants.all { variant -> - variant.outputs.all { output -> - if (outputFileName.endsWith('.apk')) { - def fileName = "MpMaster_v${defaultConfig.versionName}_rel_${new Date(System.currentTimeMillis()).format("yyyyMMdd")}.apk" - outputFileName = fileName - } - } - } } debug { jniDebuggable true - android.applicationVariants.all { variant -> - variant.outputs.all { output -> - if (outputFileName.endsWith('.apk')) { - def fileName = "MpMaster_v${defaultConfig.versionName}_${new Date(System.currentTimeMillis()).format("yyyyMMdd")}.apk" - outputFileName = fileName - } + } + } + + android.applicationVariants.all { variant -> + variant.outputs.all { output -> + if (outputFileName.endsWith('.apk')) { + def buildTypeFlag = "dbg" + if(variant.buildType.name.equals('release')) { + buildTypeFlag = "rel" } + def fileName = "MpMaster_v${defaultConfig.versionName}_${buildTypeFlag}_${new Date(System.currentTimeMillis()).format("yyyyMMdd")}.apk" + outputFileName = fileName } } }