星火管控
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

build.gradle.kts 5.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. @file:Suppress("CAST_NEVER_SUCCEEDS")
  2. import java.text.SimpleDateFormat
  3. import java.util.Date
  4. @Suppress("DSL_SCOPE_VIOLATION") // TODO: Remove once KTIJ-19369 is fixed
  5. plugins {
  6. alias(libs.plugins.androidApplication)
  7. alias(libs.plugins.kotlinAndroid)
  8. }
  9. android {
  10. namespace = "com.xhkjedu.manageapp"
  11. compileSdk = 34
  12. defaultConfig {
  13. applicationId = "com.xhkjedu.manageapp"
  14. minSdk = 24
  15. targetSdk = 30
  16. versionCode = 12
  17. versionName = "1.0.11"
  18. testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
  19. vectorDrawables {
  20. useSupportLibrary = true
  21. }
  22. ndk{
  23. abiFilters += listOf("armeabi","armeabi-v7a","arm64-v8a","x86","x86_64")
  24. }
  25. }
  26. viewBinding{
  27. enable=true
  28. }
  29. signingConfigs {
  30. create("keystore") {
  31. keyAlias = "xinghuo"
  32. keyPassword = "xhkjedu"
  33. storeFile = file("xinghuo.keystore")
  34. storePassword = "xhkjedu"
  35. }
  36. }
  37. buildTypes {
  38. /* release {
  39. isMinifyEnabled = false
  40. proguardFiles(
  41. getDefaultProguardFile("proguard-android-optimize.txt"),
  42. "proguard-rules.pro"
  43. )
  44. }*/
  45. val signConfig=signingConfigs.getByName("keystore")
  46. getByName("release") {
  47. isMinifyEnabled = false
  48. proguardFiles(
  49. getDefaultProguardFile("proguard-android-optimize.txt"),
  50. "proguard-rules.pro"
  51. )
  52. signingConfig=signConfig
  53. }
  54. getByName("debug") {
  55. isMinifyEnabled = false
  56. proguardFiles(
  57. getDefaultProguardFile("proguard-android-optimize.txt"),
  58. "proguard-rules.pro"
  59. )
  60. signingConfig=signConfig
  61. }
  62. }
  63. compileOptions {
  64. sourceCompatibility = JavaVersion.VERSION_1_8
  65. targetCompatibility = JavaVersion.VERSION_1_8
  66. }
  67. kotlinOptions {
  68. jvmTarget = "1.8"
  69. }
  70. buildFeatures {
  71. compose = true
  72. }
  73. composeOptions {
  74. kotlinCompilerExtensionVersion = "1.4.3"
  75. }
  76. packaging {
  77. resources {
  78. excludes += "/META-INF/{AL2.0,LGPL2.1}"
  79. }
  80. }
  81. lint {
  82. abortOnError=false
  83. }
  84. fun releaseTime(): String {
  85. val dateFormat = SimpleDateFormat("yyyyMMdd")
  86. return dateFormat.format(Date())
  87. }
  88. applicationVariants.all{
  89. val versionName = this.versionName
  90. val versionCode = this.versionCode
  91. val variantName = this.name
  92. outputs.all {
  93. if (this is com.android.build.gradle.internal.api.ApkVariantOutputImpl){
  94. val fileName = "Manage_App-$variantName-$versionName-$versionCode-${releaseTime()}.apk"
  95. this.outputFileName=fileName
  96. }
  97. }
  98. }
  99. /* applicationVariants.all(
  100. object : Action<com.android.build.gradle.api.ApplicationVariant> {
  101. override fun execute(variant: com.android.build.gradle.api.ApplicationVariant) {
  102. println("variant: $variant")
  103. variant.outputs.all(
  104. object : Action<com.android.build.gradle.api.BaseVariantOutput> {
  105. override fun execute(
  106. output: com.android.build.gradle.api.BaseVariantOutput
  107. ) {
  108. val versionName = variant.versionName
  109. val versionCode = variant.versionCode
  110. val variantName = variant.name
  111. val outputImpl = output as com.android.build.gradle.internal.api.BaseVariantOutputImpl
  112. val fileName = "Manage_App-$variantName-$versionName-$versionCode-${releaseTime()}.apk"
  113. println("output file name: $fileName")
  114. outputImpl.outputFileName = fileName
  115. }
  116. }
  117. )
  118. }
  119. }
  120. )*/
  121. }
  122. dependencies {
  123. implementation(libs.core.ktx)
  124. implementation(libs.lifecycle.runtime.ktx)
  125. implementation(libs.activity.compose)
  126. implementation(platform(libs.compose.bom))
  127. implementation(libs.ui)
  128. implementation(libs.ui.graphics)
  129. implementation(libs.ui.tooling.preview)
  130. implementation(libs.material3)
  131. implementation(libs.appcompat)
  132. implementation(libs.androidx.recyclerview)
  133. implementation(project(mapOf("path" to ":websocket")))
  134. implementation(libs.androidx.cardview)
  135. testImplementation(libs.junit)
  136. implementation("com.baidu.lbsyun:BaiduMapSDK_Location_All:9.3.7")
  137. implementation("com.tencent.bugly:crashreport:latest.release")
  138. androidTestImplementation(libs.androidx.test.ext.junit)
  139. androidTestImplementation(libs.espresso.core)
  140. androidTestImplementation(platform(libs.compose.bom))
  141. androidTestImplementation(libs.ui.test.junit4)
  142. debugImplementation(libs.ui.tooling)
  143. debugImplementation(libs.ui.test.manifest)
  144. }