build.gradle 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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 = [APP_NAME: "国粮质检-测试"]
  91. applicationIdSuffix ".debug"
  92. }
  93. product {
  94. dimension "default"
  95. manifestPlaceholders = [APP_NAME: "国粮质检"]
  96. }
  97. }
  98. lintOptions {
  99. checkReleaseBuilds false
  100. abortOnError false
  101. }
  102. dependencies {
  103. implementation fileTree(include: ['*.jar'], dir: 'libs')
  104. implementation 'com.amap.api:location:5.6.0'
  105. //打印库
  106. implementation files('libs/3.2.2-release.aar')
  107. //接⼊机型包含B50/B50W/B11/T6/T7/T8系列打印机需要引⼊该包,如不包含则可以不引⼊
  108. implementation files('libs/LPAPI-2019-11-20-R.jar')
  109. implementation files('libs/image-1.8.4.6.aar')
  110. // btp打印机库
  111. implementation files('libs/LabelPrinterJavaSDK.jar')
  112. //权限库
  113. implementation 'com.guolindev.permissionx:permissionx:1.7.1'
  114. }
  115. }
  116. flutter {
  117. source '../..'
  118. }