| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- import java.time.LocalDateTime
- import java.time.format.DateTimeFormatter
- import java.time.ZoneId
- 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.atmob.keyboard"
- 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 {
- applicationId = rootProject.extra["applicationId"] as String
- minSdk = rootProject.extra["minSdkVersion"] as Int
- targetSdk = rootProject.extra["targetSdkVersion"] as Int
- versionCode = flutter.versionCode
- versionName = flutter.versionName
- ndk {
- abiFilters.add("arm64-v8a")
- }
- }
- signingConfigs {
- create("keyboard") {
- storeFile = file("keystore/keyboard.jks")
- storePassword = "keyboard888"
- keyAlias = "keyboard"
- keyPassword = "keyboard888"
- }
- }
- buildTypes {
- getByName("debug") {
- // 允许debug
- isDebuggable = true
- // 是否开启混淆
- // isMinifyEnabled = true
- // proguardFiles(
- // getDefaultProguardFile("proguard-android-optimize.txt"),
- // "proguard-rules.pro"
- // )
- // Note: The debug build type must have the same signing config as the main build type.
- signingConfig = signingConfigs.getByName("keyboard")
- }
- 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("keyboard")
- }
- }
- applicationVariants.all {
- val variant = this
- variant.outputs.map { it as com.android.build.gradle.internal.api.BaseVariantOutputImpl }
- .forEach { output ->
- val formatter = DateTimeFormatter.ofPattern("yyyyMMddHHmm")
- val date = LocalDateTime.now(ZoneId.of("Asia/Shanghai")).format(formatter)
- val outputFileName =
- "${variant.applicationId}-v${variant.versionName}-${variant.baseName}-${date}.apk"
- output.outputFileName = outputFileName
- }
- }
- }
- flutter {
- source = "../.."
- }
|