build.gradle 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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. // 极光
  43. manifestPlaceholders = [
  44. JPUSH_PKGNAME : "com.szls.lszlgl",
  45. JPUSH_APPKEY : "bdf569ea1c5774d48b55c4c8",
  46. JPUSH_CHANNEL : "developer-default",
  47. ]
  48. // ndk {
  49. // abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86_64'
  50. // }
  51. }
  52. println "targetSdkVersion: ${flutter.targetSdkVersion}"
  53. // 签名配置
  54. signingConfigs {
  55. release {
  56. v1SigningEnabled true
  57. v2SigningEnabled true
  58. storeFile file(KEY_PATH)
  59. storePassword KEY_PWD
  60. keyAlias = ALIAS_NAME
  61. keyPassword ALIAS_PWD
  62. }
  63. }
  64. buildTypes {
  65. release {
  66. proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
  67. signingConfig signingConfigs.release
  68. shrinkResources false // 重要,打印机有so库,fix bug: https://github.com/flutter/flutter/issues/47527
  69. minifyEnabled false // 重要,打印机有so库,fix bug: https://github.com/flutter/flutter/issues/47527
  70. }
  71. profile {
  72. signingConfig signingConfigs.release
  73. shrinkResources false // 重要,打印机有so库,fix bug: https://github.com/flutter/flutter/issues/47527
  74. minifyEnabled false // 重要,打印机有so库,fix bug: https://github.com/flutter/flutter/issues/47527
  75. }
  76. debug {
  77. signingConfig signingConfigs.release
  78. }
  79. }
  80. android.applicationVariants.all {
  81. def buildType = it.buildType.name
  82. def flavor = it.productFlavors[0].name
  83. def outputFile
  84. it.outputs.each {
  85. outputFile = it.outputFile
  86. // 名称_环境_版本名称_版本号.apk
  87. // lszlgl_release_0.0.2_2.apk
  88. it.outputFileName = "lszlgl_${flavor}_${defaultConfig.versionName}_${defaultConfig.versionCode}.apk"
  89. }
  90. }
  91. // 多渠道配置
  92. flavorDimensions "default"
  93. productFlavors {
  94. develop {
  95. dimension "default"
  96. manifestPlaceholders = [APP_NAME: "国粮质检-测试"]
  97. applicationIdSuffix ".debug"
  98. }
  99. product {
  100. dimension "default"
  101. manifestPlaceholders = [APP_NAME: "国粮质检"]
  102. }
  103. }
  104. lintOptions {
  105. checkReleaseBuilds false
  106. abortOnError false
  107. }
  108. dependencies {
  109. implementation fileTree(include: ['*.jar'], dir: 'libs')
  110. implementation 'com.amap.api:location:5.6.0'
  111. //打印库
  112. implementation files('libs/3.2.2-release.aar')
  113. //接⼊机型包含B50/B50W/B11/T6/T7/T8系列打印机需要引⼊该包,如不包含则可以不引⼊
  114. implementation files('libs/LPAPI-2019-11-20-R.jar')
  115. implementation files('libs/image-1.8.4.6.aar')
  116. // btp打印机库
  117. implementation files('libs/LabelPrinterJavaSDK.jar')
  118. //权限库
  119. implementation 'com.guolindev.permissionx:permissionx:1.7.1'
  120. }
  121. }
  122. flutter {
  123. source '../..'
  124. }