修正上架時 Google Play 檢查出的 issue

This commit is contained in:
2026-04-09 23:15:19 +08:00
parent af27b77ad7
commit bdc0ee7dd4
108 changed files with 3446 additions and 276 deletions
+38 -12
View File
@@ -1,12 +1,21 @@
import java.util.Properties
import java.io.FileInputStream
// 1. 在 android 區塊上方讀取 key.properties 設定檔
val keystoreProperties = Properties()
val keystorePropertiesFile = rootProject.file("key.properties")
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(FileInputStream(keystorePropertiesFile))
}
plugins {
id("com.android.application")
id("kotlin-android")
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
id("dev.flutter.flutter-gradle-plugin")
}
android {
namespace = "com.example.learn"
namespace = "tw.com.gex.eisapp"
compileSdk = flutter.compileSdkVersion
ndkVersion = flutter.ndkVersion
@@ -16,29 +25,46 @@ android {
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_17.toString()
// 修正原本的 jvmTarget 警告,改用較新的寫法
freeCompilerArgs += "-Xjvm-default=all"
jvmTarget = "17"
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId = "com.example.learn"
// You can update the following values to match your application needs.
// For more information, see: https://flutter.dev/to/review-gradle-config.
applicationId = "tw.com.gex.eisapp"
minSdk = flutter.minSdkVersion
targetSdk = flutter.targetSdkVersion
versionCode = flutter.versionCode
versionName = flutter.versionName
}
// 2. 定義簽署配置 (這一段非常重要)
signingConfigs {
create("release") {
keyAlias = keystoreProperties.getProperty("keyAlias")
keyPassword = keystoreProperties.getProperty("keyPassword")
storePassword = keystoreProperties.getProperty("storePassword")
// 處理 storeFile 的路徑
val path = keystoreProperties.getProperty("storeFile")
if (path != null) {
storeFile = file(path)
}
}
}
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")
getByName("release") {
// 3. 修正:將簽署配置從 "debug" 改為我們上面定義的 "release"
signingConfig = signingConfigs.getByName("release")
// 下面這兩項在初次成功打包前建議先設為 false
isMinifyEnabled = false
isShrinkResources = false
}
}
}
flutter {
source = "../.."
}
}