From d92c80e9f0b4287c16415b86a5f8300f1eeb94a5 Mon Sep 17 00:00:00 2001 From: Jane Haring <52415314+wwxiaoqi@users.noreply.github.com> Date: Sat, 13 Apr 2024 10:12:50 +0800 Subject: [PATCH] =?UTF-8?q?build:=20=E4=B8=80=E4=BA=9B=E5=9F=BA=E7=A1=80?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=20|=20Some=20basic=20updates=20(#14)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * build: Update the implementation component version * build: Modify APK naming * build: Add debug package build * style: Naming convention lowercase. --- app/build.gradle | 31 ++++++++++++++++--- app/src/main/AndroidManifest.xml | 2 +- .../org/b3log/siyuan/DebugModeChecker.java | 30 ++++++++++++++++++ .../main/java/org/b3log/siyuan/JSAndroid.java | 2 +- .../org/b3log/siyuan/KeepLiveService.java | 2 +- .../java/org/b3log/siyuan/MainActivity.java | 8 +++-- app/src/main/res/values/strings.xml | 3 -- 7 files changed, 66 insertions(+), 12 deletions(-) create mode 100644 app/src/main/java/org/b3log/siyuan/DebugModeChecker.java delete mode 100644 app/src/main/res/values/strings.xml diff --git a/app/build.gradle b/app/build.gradle index 5b404e2b..b987fc06 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -2,6 +2,20 @@ plugins { id 'com.android.application' } +// By appending the version name, build type, and a timestamp to the APK filename, +// it becomes very easy for testers and developers to identify exactly which version of the application they are testing. +// This is particularly useful when multiple versions or builds are being tested simultaneously. +// Testers don’t need to manually rename APKs to keep track of different builds or worry about which version is the latest. +android.applicationVariants.configureEach { variant -> + variant.outputs.configureEach { output -> + def formattedDate = new Date().format('yyyyMMddHHmmss') + def versionName = variant.versionName + def buildType = variant.buildType.name + def newApkName = "siyuan-${versionName}-${buildType}-${formattedDate}.apk" + output.outputFileName = newApkName + } +} + android { compileSdkVersion 34 buildToolsVersion "34" @@ -18,6 +32,15 @@ android { release { minifyEnabled true shrinkResources true + resValue "string", "app_name", "SiYuan" + resValue "string", "app_package_name", "org.b3log.siyuan" + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + debug { + applicationIdSuffix ".debug" + minifyEnabled false + resValue "string", "app_name", "SiYuan-Debug" + resValue "string", "app_package_name", "org.b3log.siyuan.debug" proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } @@ -56,10 +79,10 @@ android { } dependencies { - implementation 'androidx.appcompat:appcompat:1.6.0' - implementation 'com.google.android.material:material:1.8.0' - implementation 'androidx.lifecycle:lifecycle-process:2.5.1' - implementation 'androidx.work:work-runtime:2.7.1' + implementation 'androidx.appcompat:appcompat:1.6.1' + implementation 'com.google.android.material:material:1.10.0' + implementation 'androidx.lifecycle:lifecycle-process:2.6.1' + implementation 'androidx.work:work-runtime:2.8.1' implementation(name: 'kernel', ext: 'aar') implementation("commons-io:commons-io:2.5") // 不要升级,否则无法兼容 Android 7 diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index ba5cdb2e..441dd900 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -83,7 +83,7 @@ - SiYuan - \ No newline at end of file