build.gradle 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. def localProperties = new Properties()
  2. def localPropertiesFile = rootProject.file('local.properties')
  3. if (localPropertiesFile.exists()) {
  4. localPropertiesFile.withReader('UTF-8') { reader ->
  5. localProperties.load(reader)
  6. }
  7. }
  8. def flutterRoot = localProperties.getProperty('flutter.sdk')
  9. if (flutterRoot == null) {
  10. throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
  11. }
  12. def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
  13. if (flutterVersionCode == null) {
  14. flutterVersionCode = '1'
  15. }
  16. def flutterVersionName = localProperties.getProperty('flutter.versionName')
  17. if (flutterVersionName == null) {
  18. flutterVersionName = '1.0'
  19. }
  20. def signingConfigKeyAlias = localProperties.getProperty("signingConfig.keyAlias")
  21. if (signingConfigKeyAlias == null) {
  22. signingConfigKeyAlias = ''
  23. }
  24. def signingConfigKeyPassword = localProperties.getProperty("signingConfig.keyPassword")
  25. if (signingConfigKeyPassword == null) {
  26. signingConfigKeyPassword = ''
  27. }
  28. def signingConfigStoreFilePath = localProperties.getProperty("signingConfig.storeFilePath")
  29. if (signingConfigStoreFilePath == null) {
  30. signingConfigStoreFilePath = ''
  31. }
  32. def signingConfigStorePassword = localProperties.getProperty("signingConfig.storePassword")
  33. if (signingConfigStorePassword == null) {
  34. signingConfigStorePassword = ''
  35. }
  36. apply plugin: 'com.android.application'
  37. apply plugin: 'kotlin-android'
  38. apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
  39. //[huawei4]
  40. // apply plugin: 'com.huawei.agconnect'
  41. android {
  42. // compileSdkVersion flutter.compileSdkVersion
  43. compileSdkVersion 34
  44. ndkVersion flutter.ndkVersion
  45. compileOptions {
  46. sourceCompatibility JavaVersion.VERSION_1_8
  47. targetCompatibility JavaVersion.VERSION_1_8
  48. }
  49. kotlinOptions {
  50. jvmTarget = '1.8'
  51. }
  52. sourceSets {
  53. main.java.srcDirs += 'src/main/kotlin'
  54. }
  55. signingConfigs {
  56. release {
  57. v1SigningEnabled true
  58. v2SigningEnabled true
  59. keyAlias signingConfigKeyAlias
  60. keyPassword signingConfigKeyPassword
  61. storeFile file(signingConfigStoreFilePath)
  62. storePassword signingConfigStorePassword
  63. }
  64. debug {
  65. v1SigningEnabled true
  66. v2SigningEnabled true
  67. keyAlias signingConfigKeyAlias
  68. keyPassword signingConfigKeyPassword
  69. storeFile file(signingConfigStoreFilePath)
  70. storePassword signingConfigStorePassword
  71. }
  72. }
  73. defaultConfig {
  74. applicationId "net.zoneland.x.bpm.mobile.v1.zone_jgjs"
  75. // You can update the following values to match your application needs.
  76. // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
  77. minSdkVersion 21 //flutter.minSdkVersion
  78. targetSdkVersion flutter.targetSdkVersion
  79. versionCode flutterVersionCode.toInteger()
  80. versionName flutterVersionName
  81. ndk {
  82. //选择要添加的对应 cpu 类型的 .so 库。
  83. abiFilters 'armeabi-v7a', 'x86_64', 'arm64-v8a'
  84. }
  85. manifestPlaceholders = [
  86. JPUSH_PKGNAME : applicationId,
  87. JPUSH_APPKEY : "9aca7cc20fe0cc987cd913ca", // NOTE: JPush 上注册的包名对应的 Appkey.
  88. JPUSH_CHANNEL : "o2oa_flutter_channel", //暂时填写默认值即可.
  89. //[xiaomi2]
  90. //[xiaomi3]
  91. //[oppo1]
  92. //[oppo2]
  93. //[oppo3]
  94. //[vivo1]
  95. //[vivo2]
  96. ]
  97. }
  98. buildTypes {
  99. debug {
  100. signingConfig signingConfigs.release
  101. }
  102. release {
  103. signingConfig signingConfigs.release
  104. // 开启删除无用资源打包后可能导致apk无法加载TBS内核库失败
  105. //关闭删除无用资源
  106. shrinkResources false
  107. //关闭删除无用代码
  108. zipAlignEnabled true
  109. minifyEnabled true
  110. proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
  111. }
  112. }
  113. }
  114. flutter {
  115. source '../..'
  116. }
  117. dependencies {
  118. implementation fileTree(include: ['*.jar','*.aar'], dir: 'libs')
  119. implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
  120. //[huawei5]
  121. // implementation 'com.huawei.hms:push:6.12.0.300'
  122. //[huawei6]
  123. // implementation 'cn.jiguang.sdk.plugin:huawei:5.2.0'
  124. //[xiaomi1]
  125. // implementation 'cn.jiguang.sdk.plugin:xiaomi:5.2.0'
  126. //[oppo4]
  127. // implementation 'cn.jiguang.sdk.plugin:oppo:5.2.0'
  128. //[oppo5]
  129. // implementation 'com.google.code.gson:gson:2.6.2'
  130. //[oppo6]
  131. // implementation 'commons-codec:commons-codec:1.6'
  132. //[oppo7]
  133. // implementation 'androidx.annotation:annotation:1.1.0'
  134. //[vivo3]
  135. // implementation 'cn.jiguang.sdk.plugin:vivo:5.2.0.a'
  136. }