build.gradle 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. plugins {
  2. id "com.android.application"
  3. id "kotlin-android"
  4. id "dev.flutter.flutter-gradle-plugin"
  5. }
  6. def localProperties = new Properties()
  7. def localPropertiesFile = rootProject.file('local.properties')
  8. if (localPropertiesFile.exists()) {
  9. localPropertiesFile.withReader('UTF-8') { reader ->
  10. localProperties.load(reader)
  11. }
  12. }
  13. def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
  14. if (flutterVersionCode == null) {
  15. flutterVersionCode = '1'
  16. }
  17. def flutterVersionName = localProperties.getProperty('flutter.versionName')
  18. if (flutterVersionName == null) {
  19. flutterVersionName = '1.0'
  20. }
  21. android {
  22. namespace "com.szls.lszlgl"
  23. compileSdkVersion flutter.compileSdkVersion
  24. ndkVersion flutter.ndkVersion
  25. compileOptions {
  26. sourceCompatibility JavaVersion.VERSION_1_8
  27. targetCompatibility JavaVersion.VERSION_1_8
  28. }
  29. sourceSets {
  30. main {
  31. jniLibs.srcDirs = ['libs']
  32. }
  33. }
  34. defaultConfig {
  35. applicationId "com.szls.lszlgl"
  36. // You can update the following values to match your application needs.
  37. // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
  38. minSdkVersion 21
  39. targetSdkVersion flutter.targetSdkVersion
  40. versionCode flutterVersionCode.toInteger()
  41. versionName flutterVersionName
  42. // ndk {
  43. // abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86_64'
  44. // }
  45. }
  46. println "targetSdkVersion: ${flutter.targetSdkVersion}"
  47. // 签名配置
  48. signingConfigs {
  49. release {
  50. v1SigningEnabled true
  51. v2SigningEnabled true
  52. storeFile file(KEY_PATH)
  53. storePassword KEY_PWD
  54. keyAlias = ALIAS_NAME
  55. keyPassword ALIAS_PWD
  56. }
  57. }
  58. buildTypes {
  59. release {
  60. proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
  61. signingConfig signingConfigs.release
  62. shrinkResources false // 重要,打印机有so库,fix bug: https://github.com/flutter/flutter/issues/47527
  63. minifyEnabled false // 重要,打印机有so库,fix bug: https://github.com/flutter/flutter/issues/47527
  64. }
  65. profile {
  66. signingConfig signingConfigs.release
  67. shrinkResources false // 重要,打印机有so库,fix bug: https://github.com/flutter/flutter/issues/47527
  68. minifyEnabled false // 重要,打印机有so库,fix bug: https://github.com/flutter/flutter/issues/47527
  69. }
  70. debug {
  71. signingConfig signingConfigs.release
  72. }
  73. }
  74. android.applicationVariants.all {
  75. def buildType = it.buildType.name
  76. def flavor = it.productFlavors[0].name
  77. def outputFile
  78. it.outputs.each {
  79. outputFile = it.outputFile
  80. // 名称_环境_版本名称_版本号.apk
  81. // lszlgl_release_0.0.2_2.apk
  82. it.outputFileName = "lszlgl_${flavor}_${defaultConfig.versionName}_${defaultConfig.versionCode}.apk"
  83. }
  84. }
  85. // 多渠道配置
  86. flavorDimensions "default"
  87. productFlavors {
  88. develop {
  89. dimension "default"
  90. manifestPlaceholders = [
  91. APP_NAME : "国粮质检-测试",
  92. // 极光 注意测试环境的 packagename 和appkey 均不一样
  93. JPUSH_PKGNAME: "com.szls.lszlgl.debug",
  94. JPUSH_APPKEY : "2f42e3db4d0083b0bc5a3f6c",
  95. JPUSH_CHANNEL: "developer-default"
  96. ]
  97. applicationIdSuffix ".debug"
  98. }
  99. product {
  100. dimension "default"
  101. manifestPlaceholders = [
  102. APP_NAME : "国粮质检",
  103. // 极光 注意测试环境的 packagename 和appkey 均不一样
  104. JPUSH_PKGNAME: "com.szls.lszlgl",
  105. JPUSH_APPKEY : "???", // 正式环境appkey需要再申请
  106. JPUSH_CHANNEL: "developer-default"
  107. ]
  108. }
  109. }
  110. lintOptions {
  111. checkReleaseBuilds false
  112. abortOnError false
  113. }
  114. dependencies {
  115. implementation fileTree(include: ['*.jar'], dir: 'libs')
  116. implementation 'com.amap.api:location:5.6.0'
  117. //打印库
  118. implementation files('libs/3.2.2-release.aar')
  119. //接⼊机型包含B50/B50W/B11/T6/T7/T8系列打印机需要引⼊该包,如不包含则可以不引⼊
  120. implementation files('libs/LPAPI-2019-11-20-R.jar')
  121. implementation files('libs/image-1.8.4.6.aar')
  122. // btp打印机库
  123. implementation files('libs/LabelPrinterJavaSDK.jar')
  124. //权限库
  125. implementation 'com.guolindev.permissionx:permissionx:1.7.1'
  126. }
  127. }
  128. flutter {
  129. source '../..'
  130. }