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.trace.location" compileSdk = rootProject.extra["compileSdkVersion"] as Int ndkVersion = rootProject.extra["ndkVersion"] as String 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 = rootProject.extra["applicationId"] as String // You can update the following values to match your application needs. // For more information, see: https://flutter.dev/to/review-gradle-config. minSdk = rootProject.extra["minSdkVersion"] as Int targetSdk = rootProject.extra["targetSdkVersion"] as Int versionCode = flutter.versionCode versionName = flutter.versionName ndk { //noinspection ChromeOsAbiSupport abiFilters.add("arm64-v8a") } } signingConfigs { create("location") { storeFile = file("keystore/location.jks") storePassword = "location888" keyAlias = "location" keyPassword = "location888" } } android { buildTypes { getByName("debug") { // Note: The debug build type must have the same signing config as the main build type. signingConfig = signingConfigs.getByName("location") } getByName("release") { // TODO: Add your own signing config for the release build. // Signing with the debug keys for now, so `flutter run --release` works. isMinifyEnabled = true proguardFiles( getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro" ) signingConfig = signingConfigs.getByName("location") } } } // applicationVariants.all { variant -> // val date = java.text.SimpleDateFormat("yyMMddHHmmss").format(Date()) // 改用 SimpleDateFormat // variant.outputs.configureEach { // 使用 configureEach 替代 all // val fileName = "${defaultConfig.applicationId}-" + // "v${defaultConfig.versionName}-" + // "${variant.buildType.name}-" + // "${date}.apk" // this as com.android.build.gradle.internal.api.BaseVariantOutputImpl // 强制类型转换 // outputFileName.set(fileName) // 正确设置文件名 // } // } } flutter { source = "../.." }