build.gradle 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. /*
  2. * @Author: XianKaiQun
  3. * @Date: 2020-03-31 18:07:43
  4. * @LastEditors : WuWei
  5. * @LastEditTime : 2023-05-17 09:38:41
  6. * @Descripttion:
  7. */
  8. //读取打包证书
  9. def keystorePropertiesFile = rootProject.file("cert/key.properties")
  10. def keystoreProperties = new Properties()
  11. keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
  12. //读取local.properties
  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 GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
  23. // }
  24. def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
  25. if (flutterVersionCode == null) {
  26. flutterVersionCode = '1'
  27. }
  28. def flutterVersionName = localProperties.getProperty('flutter.versionName')
  29. if (flutterVersionName == null) {
  30. flutterVersionName = '1.0'
  31. }
  32. apply plugin: 'com.android.application'
  33. apply plugin: 'kotlin-android'
  34. apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
  35. android {
  36. compileSdkVersion 35 //flutter.compileSdkVersion
  37. ndkVersion "27.0.12077973"
  38. sourceSets {
  39. main.java.srcDirs += 'src/main/kotlin'
  40. }
  41. //多渠道打包
  42. flavorDimensions "type"
  43. productFlavors{
  44. dev{
  45. dimension "type"
  46. applicationId "cn.huifuwu.appdev"
  47. manifestPlaceholders = [
  48. APP_NAME: "绘服务dev",
  49. //高德
  50. // AMAP_KEY : "ceca571ebb034cfa994cc772dace12cc",
  51. ]
  52. }
  53. prod{
  54. dimension "type"
  55. applicationId "cn.huifuwu.app"
  56. manifestPlaceholders = [
  57. APP_NAME: "绘服务",
  58. //高德
  59. // AMAP_KEY : "8a246a9e2a9f110609d2e13524948fec",
  60. ]
  61. }
  62. }
  63. defaultConfig {
  64. minSdk 27
  65. targetSdk 35
  66. // 使用自带的sdk版本
  67. //flutter.targetSdkVersion
  68. versionCode flutterVersionCode.toInteger()
  69. versionName flutterVersionName
  70. testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
  71. //multiDexEnabled true ////报dex超过64k时需要
  72. }
  73. compileOptions {
  74. sourceCompatibility = JavaVersion.VERSION_17
  75. targetCompatibility = JavaVersion.VERSION_17
  76. }
  77. kotlinOptions {
  78. jvmTarget = "17"
  79. }
  80. //配置打包证书
  81. signingConfigs {
  82. release {
  83. keyAlias keystoreProperties['keyAlias']
  84. keyPassword keystoreProperties['keyPassword']
  85. storeFile file(keystoreProperties['storeFile'])
  86. storePassword keystoreProperties['storePassword']
  87. }
  88. }
  89. buildTypes {
  90. release {
  91. signingConfig signingConfigs.release
  92. }
  93. debug {
  94. minifyEnabled true
  95. signingConfig signingConfigs.release
  96. }
  97. profile {
  98. signingConfig signingConfigs.release
  99. }
  100. }
  101. namespace 'cn.huifuwu.app'
  102. // buildToolsVersion '36.0.0 rc5'
  103. }
  104. flutter {
  105. source '../..'
  106. }
  107. dependencies {
  108. // 此处以JPush 5.6.0 版本为例,注意:从 5.0.0 版本开始可以自动拉取 JCore 包,无需另外配置
  109. implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
  110. testImplementation 'junit:junit:4.13.2'
  111. androidTestImplementation 'androidx.test.ext:junit:1.1.5'
  112. androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
  113. // implementation 'com.android.support:multidex:1.0.1' //报dex超过64k时需要
  114. //引入高德地图SDK 已去除
  115. // implementation('com.amap.api:3dmap:7.7.0')
  116. // implementation('com.amap.api:location:5.2.0')
  117. }