build.gradle 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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. defaultConfig {
  30. applicationId "com.szls.lszlgl"
  31. // You can update the following values to match your application needs.
  32. // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
  33. minSdkVersion 21
  34. targetSdkVersion flutter.targetSdkVersion
  35. versionCode flutterVersionCode.toInteger()
  36. versionName flutterVersionName
  37. }
  38. println "targetSdkVersion: ${flutter.targetSdkVersion}"
  39. // 签名配置
  40. signingConfigs {
  41. release {
  42. v1SigningEnabled true
  43. v2SigningEnabled true
  44. storeFile file(KEY_PATH)
  45. storePassword KEY_PWD
  46. keyAlias = ALIAS_NAME
  47. keyPassword ALIAS_PWD
  48. }
  49. }
  50. buildTypes {
  51. release {
  52. proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
  53. signingConfig signingConfigs.release
  54. manifestPlaceholders = [APP_NAME: "国粮质检"]
  55. }
  56. profile {
  57. signingConfig signingConfigs.release
  58. manifestPlaceholders = [APP_NAME: "国粮质检-测试"]
  59. applicationIdSuffix ".debug"
  60. }
  61. debug {
  62. signingConfig signingConfigs.release
  63. manifestPlaceholders = [APP_NAME: "国粮质检-测试"]
  64. applicationIdSuffix ".debug"
  65. }
  66. }
  67. android.applicationVariants.all {
  68. def buildType = it.buildType.name
  69. def outputFile
  70. it.outputs.each {
  71. outputFile = it.outputFile
  72. // 名称_环境_版本名称_版本号.apk
  73. // lszlgl_release_0.0.2_2.apk
  74. it.outputFileName = "lszlgl_${buildType}_${defaultConfig.versionName}_${defaultConfig.versionCode}.apk"
  75. }
  76. }
  77. dependencies {
  78. implementation fileTree(include: ['*.jar'], dir: 'libs')
  79. implementation 'com.amap.api:location:5.6.0'
  80. //打印库
  81. implementation files('libs/3.2.2-release.aar')
  82. //接⼊机型包含B50/B50W/B11/T6/T7/T8系列打印机需要引⼊该包,如不包含则可以不引⼊
  83. implementation files('libs/LPAPI-2019-11-20-R.jar')
  84. implementation files('libs/image-1.8.4.6.aar')
  85. //权限库
  86. implementation 'com.guolindev.permissionx:permissionx:1.7.1'
  87. }
  88. }
  89. flutter {
  90. source '../..'
  91. }