From e52e21d295291a27113afe897c37bc525f158cf9 Mon Sep 17 00:00:00 2001 From: sccsbc Date: Fri, 10 Jul 2026 14:20:54 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20Android=20=E6=AD=A3=E5=BC=8F=E7=AD=BE?= =?UTF-8?q?=E5=90=8D=E9=85=8D=E7=BD=AE=20+=20=E6=88=AA=E5=9B=BE=E5=B0=BA?= =?UTF-8?q?=E5=AF=B8=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 生成 release.jks 正式签名密钥库 - build.gradle.kts 配置 release 签名自动读取 key.properties - .gitignore 排除 keystore 和 key.properties - 截图调整为 6.5 寸规格 (1242x2688) Co-Authored-By: Claude --- .gitignore | 4 ++++ health_app/android/app/build.gradle.kts | 26 +++++++++++++++++++------ 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 9f53382..8dbb5b3 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,10 @@ *.key *.pfx +# Android release keystore +health_app/android/**/*.jks +health_app/android/key.properties + # .NET build outputs backend/**/bin/ backend/**/obj/ diff --git a/health_app/android/app/build.gradle.kts b/health_app/android/app/build.gradle.kts index b69a7ca..28b7b20 100644 --- a/health_app/android/app/build.gradle.kts +++ b/health_app/android/app/build.gradle.kts @@ -5,6 +5,13 @@ plugins { id("dev.flutter.flutter-gradle-plugin") } +// 加载正式签名配置 +val keystorePropertiesFile = rootProject.file("key.properties") +val keystoreProperties = java.util.Properties() +if (keystorePropertiesFile.exists()) { + keystoreProperties.load(keystorePropertiesFile.inputStream()) +} + android { namespace = "com.datalumina.YYA" compileSdk = flutter.compileSdkVersion @@ -20,21 +27,28 @@ android { } defaultConfig { - // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId = "com.datalumina.YYA" - // You can update the following values to match your application needs. - // For more information, see: https://flutter.dev/to/review-gradle-config. minSdk = flutter.minSdkVersion targetSdk = flutter.targetSdkVersion versionCode = flutter.versionCode versionName = flutter.versionName } + // 正式签名配置 + signingConfigs { + create("release") { + if (keystorePropertiesFile.exists()) { + keyAlias = keystoreProperties["keyAlias"] as String? + keyPassword = keystoreProperties["keyPassword"] as String? + storeFile = keystoreProperties["storeFile"]?.let { file(it) } + storePassword = keystoreProperties["storePassword"] as String? + } + } + } + buildTypes { release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig = signingConfigs.getByName("debug") + signingConfig = signingConfigs.getByName("release") } } }