import java.util.Properties val localPropertiesFile = rootProject.file("key.properties") val localProperties = Properties() if (localPropertiesFile.exists()) { localPropertiesFile.inputStream().use { inputStream -> localProperties.load(inputStream) } } 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") id("com.google.gms.google-services") } android { namespace = "jigsort.solitaire.jigsaw.match.games" // compileSdk = flutter.compileSdkVersion // ndkVersion = flutter.ndkVersion compileSdk = 36 ndkVersion = "27.0.12077973" compileOptions { sourceCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_11 } kotlinOptions { jvmTarget = JavaVersion.VERSION_11.toString() } defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId = "jigsort.solitaire.jigsaw.match.games" // 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 minSdk = 23 targetSdk = flutter.targetSdkVersion versionCode = flutter.versionCode versionName = flutter.versionName } signingConfigs { create("release") { // 使用 create 方法来定义签名配置 storeFile = file(localProperties.getProperty("storeFile")) storePassword = localProperties.getProperty("storePassword") keyAlias = localProperties.getProperty("keyAlias") keyPassword = localProperties.getProperty("keyPassword") } } buildTypes { release { // ✅ 启用 R8 代码混淆和收缩(Kotlin DSL: 使用 isMinifyEnabled = true) isMinifyEnabled = true // ✅ 启用资源收缩(Kotlin DSL: 使用 isShrinkResources = true) isShrinkResources = true // ✅ 指定 ProGuard 规则文件(Kotlin DSL: 使用 proguardFiles(...) 函数) proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") // 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") } } } flutter { source = "../.." }