build.gradle 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. plugins {
  2. id 'com.android.application'
  3. }
  4. def releaseTime() {
  5. return new Date().format("yyyyMMddHHmmss", TimeZone.getTimeZone("CTT"))
  6. }
  7. android {
  8. compileSdk 30
  9. defaultConfig {
  10. applicationId "com.efunbox.reader"
  11. minSdk 21
  12. //noinspection ExpiredTargetSdkVersion
  13. targetSdk 28
  14. versionCode 40
  15. versionName "4.0"
  16. testInstrumentationRunner
  17. flavorDimensions "versionCode"
  18. manifestPlaceholders = [UMENG_CHANNEL_VALUE: "2006"]//添加一个默认渠道号
  19. multiDexEnabled true
  20. ndk {
  21. abiFilters "arm64-v8a"
  22. abiFilters "armeabi-v7a"
  23. abiFilters "armeabi"
  24. abiFilters "x86"
  25. // 添加x86必须添加x86_64
  26. abiFilters "x86_64"
  27. }
  28. }
  29. signingConfigs {
  30. efunboxKey {
  31. keyAlias "edufound_key"
  32. keyPassword "edufound321"
  33. storeFile file("C:/Users/candy/Desktop/efunbox/edufound.keystore")
  34. storePassword "edufound123"
  35. v1SigningEnabled true
  36. v2SigningEnabled true
  37. }
  38. }
  39. buildTypes {
  40. release {
  41. minifyEnabled false
  42. proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
  43. signingConfig signingConfigs.efunboxKey
  44. applicationVariants.all { variant ->
  45. variant.outputs.each { output ->
  46. def outputFile = output.outputFileName
  47. if (outputFile != null && output.outputFileName.endsWith('.apk')) {
  48. def fileName = "efunbox_reader_v${defaultConfig.versionCode}_${releaseTime()}_${variant.productFlavors[0].manifestPlaceholders.UMENG_CHANNEL_VALUE}_r.apk"
  49. def channel = variant.productFlavors[0].manifestPlaceholders.UMENG_CHANNEL_VALUE;
  50. def newoutputFile = "";
  51. if (channel == ("3006")) {
  52. newoutputFile = "\\义方\\"
  53. } else if (channel == ("3002")) {
  54. newoutputFile = "\\天猫精灵\\"
  55. } else if (channel == ("3003")) {
  56. newoutputFile = "\\小度音响\\"
  57. } else if (channel == ("2016")) {
  58. newoutputFile = "\\小爱音响\\"
  59. } else if (channel == ("3004")) {
  60. newoutputFile = "\\联想pad\\"
  61. } else if (channel == ("3007")) {
  62. newoutputFile = "\\京东方\\"
  63. } else if (channel == ("3008")) {
  64. newoutputFile = "\\华为pad联运\\"
  65. } else if (channel == ("3009")) {
  66. newoutputFile = "\\步步高\\"
  67. } else if (channel == ("3010")) {
  68. newoutputFile = "\\讯飞pad\\"
  69. }
  70. output.outputFileName = new File(newoutputFile, fileName)
  71. }
  72. }
  73. }
  74. }
  75. debug {
  76. minifyEnabled false
  77. proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
  78. signingConfig signingConfigs.efunboxKey
  79. zipAlignEnabled true
  80. }
  81. }
  82. compileOptions {
  83. sourceCompatibility JavaVersion.VERSION_1_8
  84. targetCompatibility JavaVersion.VERSION_1_8
  85. }
  86. buildFeatures {
  87. viewBinding true
  88. }
  89. sourceSets {
  90. main {
  91. jniLibs.srcDirs = ['libs']
  92. res.srcDirs = [
  93. 'src/main/res', //默认只有这一个路径
  94. ]
  95. }
  96. }
  97. productFlavors {
  98. //义方
  99. channel_efunbox {
  100. signingConfig signingConfigs.efunboxKey
  101. manifestPlaceholders = [
  102. appCode: "3006",
  103. appIcon: "@drawable/icon",
  104. ]
  105. }
  106. //百度(小度音响)
  107. channel_baidu {
  108. signingConfig signingConfigs.efunboxKey
  109. manifestPlaceholders = [
  110. appCode: "3003",
  111. appIcon: "@drawable/icon",
  112. ]
  113. }
  114. //天猫精灵
  115. channel_tmail {
  116. signingConfig signingConfigs.efunboxKey
  117. manifestPlaceholders = [
  118. appCode: "3002",
  119. appIcon: "@drawable/icon",
  120. ]
  121. }
  122. //小爱音响
  123. channel_xayx {
  124. applicationIdSuffix ".xiaoai"
  125. signingConfig signingConfigs.efunboxKey
  126. manifestPlaceholders = [
  127. appCode: "2016",
  128. appIcon: "@drawable/icon",
  129. ]
  130. }
  131. //联想渠道
  132. channel_lenovo {
  133. signingConfig signingConfigs.efunboxKey
  134. manifestPlaceholders = [
  135. appCode: "3004",
  136. appIcon: "@drawable/icon",
  137. ]
  138. }
  139. //京东方
  140. channel_jingdongfang {
  141. signingConfig signingConfigs.efunboxKey
  142. manifestPlaceholders = [
  143. appCode: "3007",
  144. appIcon: "@drawable/icon",
  145. ]
  146. }
  147. //华为Pad联运
  148. channel_huawei_lianyun {
  149. // apply plugin: "com.huawei.agconnect"
  150. // applicationIdSuffix ".huawei"
  151. // signingConfig signingConfigs.efunboxKey
  152. manifestPlaceholders = [
  153. appCode: "3008",
  154. appIcon: "@drawable/icon",
  155. ]
  156. }
  157. //步步高pad
  158. channel_bubugao {
  159. signingConfig signingConfigs.efunboxKey
  160. manifestPlaceholders = [
  161. appCode: "3009",
  162. appIcon: "@drawable/icon",
  163. ]
  164. }
  165. //讯飞pad
  166. channel_xunfei {
  167. signingConfig signingConfigs.efunboxKey
  168. manifestPlaceholders = [
  169. appCode: "3010",
  170. appIcon: "@drawable/icon",
  171. ]
  172. }
  173. }
  174. productFlavors.all {
  175. flavor -> flavor.manifestPlaceholders = [UMENG_CHANNEL_VALUE: manifestPlaceholders.appCode, icon: manifestPlaceholders.appIcon]
  176. }
  177. compileOptions {
  178. sourceCompatibility JavaVersion.VERSION_1_8
  179. targetCompatibility JavaVersion.VERSION_1_8
  180. }
  181. }
  182. dependencies {
  183. api userLibs.get('appcompat')
  184. api userLibs.get('material')
  185. api userLibs.get('constraintlayout')
  186. api userLibs.get('gson')
  187. api userLibs.get('recyclerview')
  188. testImplementation testLibs.get('junit')
  189. androidTestImplementation testLibs.get('junitAndroid')
  190. androidTestImplementation testLibs.get('espresso')
  191. if (isRelease) {
  192. api project(':app-pay')
  193. api project(':app-video')
  194. }
  195. api project(':app-base')
  196. }