build.gradle 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. plugins {
  2. id "com.android.application"
  3. id "kotlin-android"
  4. id "kotlin-kapt"
  5. id "dev.flutter.flutter-gradle-plugin"
  6. id 'com.google.gms.google-services'
  7. }
  8. def keystoreProperties = new Properties()
  9. def keystorePropertiesFile = rootProject.file('key.properties')
  10. if (keystorePropertiesFile.exists()) {
  11. keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
  12. }
  13. def localProperties = new Properties()
  14. def localPropertiesFile = rootProject.file('local.properties')
  15. if (localPropertiesFile.exists()) {
  16. localPropertiesFile.withReader('UTF-8') { reader ->
  17. localProperties.load(reader)
  18. }
  19. }
  20. def flutterRoot = localProperties.getProperty('flutter.sdk')
  21. if (flutterRoot == null) {
  22. throw new Exception("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
  23. }
  24. android {
  25. namespace 'com.hongyegroup.app24ifm'
  26. compileSdk 35
  27. compileOptions {
  28. // 启用核心库脱糖(Core Library Desugaring)
  29. coreLibraryDesugaringEnabled true
  30. sourceCompatibility JavaVersion.VERSION_17
  31. targetCompatibility JavaVersion.VERSION_17
  32. }
  33. kotlinOptions {
  34. jvmTarget = JavaVersion.VERSION_17
  35. }
  36. sourceSets {
  37. main.java.srcDirs += 'src/main/kotlin'
  38. }
  39. lintOptions {
  40. // 如打包出现Failed to transform libs.jar to match attributes
  41. checkReleaseBuilds false
  42. }
  43. defaultConfig {
  44. applicationId "com.hongyegroup.app24ifm"
  45. minSdkVersion 21
  46. targetSdkVersion 35
  47. versionCode 100
  48. versionName "1.0.0"
  49. testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
  50. multiDexEnabled true
  51. ndk {
  52. //选择要添加的对应 cpu 类型的 .so 库。
  53. abiFilters 'armeabi-v7a', 'arm64-v8a'
  54. // abiFilters 'armeabi-v7a'
  55. // abiFilters 'arm64-v8a'
  56. // abiFilters 'x86_64'
  57. }
  58. manifestPlaceholders = [
  59. JPUSH_PKGNAME : applicationId,
  60. JPUSH_APPKEY : "1234567890",
  61. JPUSH_CHANNEL : "developer-default",
  62. queryAllPackages: ""
  63. ]
  64. }
  65. //配置keystore签名
  66. signingConfigs {
  67. release {
  68. keyAlias keystoreProperties['keyAlias']
  69. keyPassword keystoreProperties['keyPassword']
  70. storeFile file(keystoreProperties['storeFile'])
  71. storePassword keystoreProperties['storePassword']
  72. }
  73. debug {
  74. }
  75. }
  76. buildTypes {
  77. release {
  78. signingConfig signingConfigs.release
  79. //默认系统混淆
  80. minifyEnabled true
  81. //是否可调试
  82. debuggable false
  83. //Zipalign优化
  84. zipAlignEnabled true
  85. //移除无用的resource文件
  86. shrinkResources true
  87. proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
  88. }
  89. debug {
  90. signingConfig signingConfigs.release
  91. //是否可调试
  92. debuggable true
  93. }
  94. }
  95. }
  96. flutter {
  97. source '../..'
  98. }
  99. // 覆盖所有子模块的命名空间规则
  100. subprojects {
  101. afterEvaluate { project ->
  102. if (project.hasProperty("android") && project.android.namespace == null) {
  103. project.android.namespace = "com.hongyegroup.app24ifm.${project.name}"
  104. }
  105. }
  106. }
  107. dependencies {
  108. implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.9.0"
  109. implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.9.0"
  110. coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.4'
  111. implementation 'com.github.bumptech.glide:glide:4.11.0'
  112. kapt 'com.github.bumptech.glide:compiler:4.11.0'
  113. implementation 'androidx.appcompat:appcompat:1.6.1' //加入AndroidX依赖
  114. implementation 'com.android.support:multidex:1.0.3'
  115. // implementation 'androidx.core:core-splashscreen:1.0.0' //启动12兼容
  116. }
  117. apply plugin: 'com.google.gms.google-services'