build.gradle 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  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. // applicationId "com.szls.lszlgl.debug"
  90. dimension "default"
  91. manifestPlaceholders = [
  92. APP_NAME : "国粮质检-测试",
  93. // 极光 注意测试环境的 packagename 和appkey 均不一样
  94. JPUSH_PKGNAME: "com.szls.lszlgl.debug",
  95. JPUSH_APPKEY : "2f42e3db4d0083b0bc5a3f6c",
  96. JPUSH_CHANNEL: "developer-default"
  97. ]
  98. applicationIdSuffix ".debug"
  99. }
  100. product {
  101. // applicationId "com.szls.lszlgl"
  102. dimension "default"
  103. manifestPlaceholders = [
  104. APP_NAME : "国粮质检",
  105. // 极光 注意测试环境的 packagename 和appkey 均不一样
  106. JPUSH_PKGNAME: "com.szls.lszlgl",
  107. JPUSH_APPKEY : "336425aac947172a06b70cbb", // 正式环境appkey需要再申请
  108. JPUSH_CHANNEL: "developer-default"
  109. ]
  110. }
  111. }
  112. lintOptions {
  113. checkReleaseBuilds false
  114. abortOnError false
  115. }
  116. dependencies {
  117. implementation fileTree(include: ['*.jar'], dir: 'libs')
  118. implementation 'com.amap.api:location:5.6.0'
  119. //打印库
  120. implementation files('libs/3.2.2-release.aar')
  121. //接⼊机型包含B50/B50W/B11/T6/T7/T8系列打印机需要引⼊该包,如不包含则可以不引⼊
  122. implementation files('libs/LPAPI-2019-11-20-R.jar')
  123. implementation files('libs/image-1.8.4.6.aar')
  124. // btp打印机库
  125. implementation files('libs/LabelPrinterJavaSDK.jar')
  126. //权限库
  127. implementation 'com.guolindev.permissionx:permissionx:1.7.1'
  128. }
  129. }
  130. flutter {
  131. source '../..'
  132. }