build.gradle.kts 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. import java.time.LocalDateTime
  2. import java.time.format.DateTimeFormatter
  3. import java.time.ZoneId
  4. plugins {
  5. id("com.android.application")
  6. id("kotlin-android")
  7. // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
  8. id("dev.flutter.flutter-gradle-plugin")
  9. id("com.huawei.agconnect")
  10. }
  11. android {
  12. namespace = "com.atmob.keyboard"
  13. compileSdk = rootProject.extra["compileSdkVersion"] as Int
  14. ndkVersion = rootProject.extra["ndkVersion"] as String
  15. compileOptions {
  16. sourceCompatibility = JavaVersion.VERSION_11
  17. targetCompatibility = JavaVersion.VERSION_11
  18. }
  19. kotlinOptions {
  20. jvmTarget = JavaVersion.VERSION_11.toString()
  21. }
  22. defaultConfig {
  23. applicationId = rootProject.extra["applicationId"] as String
  24. minSdk = rootProject.extra["minSdkVersion"] as Int
  25. targetSdk = rootProject.extra["targetSdkVersion"] as Int
  26. versionCode = flutter.versionCode
  27. versionName = flutter.versionName
  28. ndk {
  29. abiFilters.add("arm64-v8a")
  30. }
  31. manifestPlaceholders.putAll(
  32. mapOf(
  33. "JPUSH_PKGNAME" to applicationId!!,
  34. "JPUSH_APPKEY" to "e4c8b538fa1046eccce756de",
  35. "JPUSH_CHANNEL" to "developer-default",
  36. "XIAOMI_APPKEY" to "5652041165266",
  37. "XIAOMI_APPID" to "2882303761520411266",
  38. "VIVO_APPKEY" to "37b75015089824508ddc711e385a3df3",
  39. "VIVO_APPID" to "105899223",
  40. "OPPO_APPKEY" to "OP-2cc9d48944b440ac9480292cf80bbac5",
  41. "OPPO_APPID" to "OP-33224191",
  42. "OPPO_APPSECRET" to "OP-989965607b044943b8b1b610385cf404",
  43. "HONOR_APPID" to "104498449",
  44. )
  45. )
  46. }
  47. signingConfigs {
  48. create("keyboard") {
  49. storeFile = file("keystore/zhuiai.jks")
  50. storePassword = "zhuiai888"
  51. keyAlias = "zhuiai"
  52. keyPassword = "zhuiai888"
  53. }
  54. }
  55. buildTypes {
  56. getByName("debug") {
  57. // 允许debug
  58. isDebuggable = true
  59. // 是否开启混淆
  60. // isMinifyEnabled = true
  61. // proguardFiles(
  62. // getDefaultProguardFile("proguard-android-optimize.txt"),
  63. // "proguard-rules.pro"
  64. // )
  65. // Note: The debug build type must have the same signing config as the main build type.
  66. signingConfig = signingConfigs.getByName("keyboard")
  67. }
  68. getByName("release") {
  69. // TODO: Add your own signing config for the release build.
  70. // Signing with the debug keys for now, so `flutter run --release` works.
  71. isMinifyEnabled = true
  72. proguardFiles(
  73. getDefaultProguardFile("proguard-android-optimize.txt"),
  74. "proguard-rules.pro"
  75. )
  76. signingConfig = signingConfigs.getByName("keyboard")
  77. }
  78. }
  79. applicationVariants.all {
  80. val variant = this
  81. variant.outputs.map { it as com.android.build.gradle.internal.api.BaseVariantOutputImpl }
  82. .forEach { output ->
  83. val formatter = DateTimeFormatter.ofPattern("yyyyMMddHHmm")
  84. val date = LocalDateTime.now(ZoneId.of("Asia/Shanghai")).format(formatter)
  85. val outputFileName =
  86. "${variant.applicationId}-v${variant.versionName}-${variant.baseName}-${date}.apk"
  87. output.outputFileName = outputFileName
  88. }
  89. }
  90. dependencies {
  91. implementation("cn.jiguang.sdk.plugin:xiaomi:5.7.0")
  92. implementation("cn.jiguang.sdk.plugin:vivo:5.7.0")
  93. implementation("cn.jiguang.sdk.plugin:oppo:5.7.0")
  94. implementation("cn.jiguang.sdk.plugin:honor:5.7.0")
  95. implementation("com.google.code.gson:gson:2.6.2")
  96. implementation("commons-codec:commons-codec:1.6")
  97. implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar", "*.aar"))))
  98. implementation("androidx.annotation:annotation:1.1.0")
  99. implementation ("com.huawei.hms:push:6.12.0.300")
  100. implementation ("cn.jiguang.sdk.plugin:huawei:5.7.0")
  101. }
  102. }
  103. flutter {
  104. source = "../.."
  105. }