build.gradle 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. import org.json.JSONObject
  2. apply plugin: 'com.android.application'
  3. apply plugin: "androidx.navigation.safeargs"
  4. // 获取最新版本名称和版本号
  5. def newVersion = new JSONObject(file('../version_info.json').text).optJSONArray("info").getJSONObject(0)
  6. def vName = newVersion.optString("versionName")
  7. def vCode = newVersion.optLong("versionCode")
  8. println vName
  9. println vCode
  10. android {
  11. compileSdkVersion 28
  12. defaultConfig {
  13. applicationId "com.unis.sxzcl"
  14. minSdkVersion 16
  15. targetSdkVersion 28
  16. versionCode vCode.toInteger()
  17. versionName vName
  18. ndk {
  19. //设置支持的SO库架构
  20. abiFilters 'armeabi-v7a' //,'x86', 'x86_64', 'arm64-v8a'
  21. }
  22. multiDexEnabled true
  23. manifestPlaceholders = [
  24. JPUSH_PKGNAME : applicationId,
  25. JPUSH_APPKEY : "364961d3e7f43b10b3555e51",//值来自开发者平台取得的AppKey
  26. JPUSH_CHANNEL : "default_developer",
  27. //xiaomi_config_start
  28. XIAOMI_APPID : "MI-小米的APPID",
  29. XIAOMI_APPKEY : "MI-小米的APPKEY",
  30. //xiaomi_config_end
  31. //oppo_config_start
  32. OPPO_APPKEY : "OP-oppo的APPKEY",
  33. OPPO_APPID : "OP-oppo的APPID",
  34. OPPO_APPSECRET: "OP-oppo的APPSECRET",
  35. //oppo_config_end
  36. //vivo_config_start
  37. VIVO_APPKEY : "vivo的APPKEY",
  38. VIVO_APPID : "vivo的APPID",
  39. //vivo_config_end
  40. ]
  41. flavorDimensions "channel"
  42. }
  43. // view绑定
  44. // viewBinding {
  45. // enabled = true
  46. // }
  47. buildFeatures {
  48. viewBinding = true
  49. }
  50. // 签名配置
  51. signingConfigs {
  52. release {
  53. v1SigningEnabled true
  54. v2SigningEnabled true
  55. storeFile file(KEY_PATH)
  56. storePassword KEY_PWD
  57. keyAlias = ALIAS_NAME
  58. keyPassword ALIAS_PWD
  59. }
  60. }
  61. buildTypes {
  62. release {
  63. minifyEnabled false
  64. proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
  65. signingConfig signingConfigs.release
  66. zipAlignEnabled = true
  67. }
  68. debug {
  69. signingConfig signingConfigs.release
  70. }
  71. }
  72. compileOptions {
  73. sourceCompatibility 1.8
  74. targetCompatibility 1.8
  75. }
  76. sourceSets {
  77. main {
  78. jniLibs.srcDirs = ['libs']
  79. }
  80. }
  81. repositories {
  82. flatDir {
  83. dirs 'libs'
  84. }
  85. }
  86. lintOptions {
  87. checkReleaseBuilds false
  88. abortOnError false
  89. }
  90. //配置自定义打包名称和位置
  91. android.applicationVariants.all { variant ->
  92. // 将apk文件输出到 /apk/release 或 /apk/debug
  93. if (variant.buildType.name.equals('release')) {
  94. variant.getPackageApplicationProvider().get().outputDirectory = new File("../apk/" + variant.buildType.name)
  95. }
  96. variant.outputs.all { output ->
  97. def date = new Date().format("yyyyMMddHHmm")
  98. def versionName = defaultConfig.versionName
  99. def versionCode = defaultConfig.versionCode
  100. def buildType = variant.buildType.name
  101. // 输出的apk名称
  102. // sxzcl_release_x.x_x.apk
  103. outputFileName = "sxzcl_${buildType}_${versionName}_${versionCode}.apk"
  104. }
  105. }
  106. }
  107. dependencies {
  108. implementation fileTree(dir: "libs", include: ["*.jar"])
  109. implementation 'androidx.appcompat:appcompat:1.2.0'
  110. implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
  111. implementation 'com.android.support:design:28.0.3'
  112. implementation 'com.android.support:support-v4:28.0.0'
  113. implementation 'com.google.android:flexbox:2.0.1'
  114. implementation 'com.android.support:multidex:1.0.3'
  115. api project(path: ':icon')
  116. api project(path: ':model')
  117. //状态栏框架
  118. implementation 'com.jaeger.statusbarutil:library:1.5.1'
  119. //图片压缩
  120. implementation 'com.github.nanchen2251:CompressHelper:1.0.5'
  121. //轮播图
  122. implementation 'com.youth.banner:banner:2.1.0'
  123. implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
  124. //图表库
  125. implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
  126. implementation 'androidx.navigation:navigation-fragment:2.3.2'
  127. implementation 'androidx.navigation:navigation-ui:2.3.2'
  128. // 极光推送
  129. implementation 'cn.jiguang.sdk:jpush:3.8.6' // 此处以JPush 3.8.6 版本为例。
  130. implementation 'cn.jiguang.sdk:jcore:2.6.0' // 此处以JCore 2.6.0 版本为例。
  131. }