build.gradle 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. apply plugin: 'com.android.application'
  2. def releaseTime() {
  3. return new Date().format("yyyyMMdd", TimeZone.getTimeZone("UTC"))
  4. }
  5. //必须配置
  6. def mfph = [
  7. //包名
  8. "apk.applicationId" : "com.xwkj.sqjw",
  9. ]
  10. android {
  11. compileSdkVersion rootProject.ext.android["compileSdkVersion"]
  12. useLibrary 'org.apache.http.legacy'
  13. compileOptions {
  14. targetCompatibility JavaVersion.VERSION_1_8
  15. sourceCompatibility JavaVersion.VERSION_1_8
  16. }
  17. defaultConfig {
  18. applicationId "com.xwkj.sqjw"
  19. minSdkVersion rootProject.ext.android["minSdkVersion"]
  20. targetSdkVersion 28
  21. versionCode 100
  22. versionName "1.00"
  23. testInstrumentationRunner rootProject.ext.dependencies["androidJUnitRunner"]
  24. flavorDimensions "1"
  25. multiDexEnabled true
  26. manifestPlaceholders = mfph
  27. ndk {
  28. abiFilters 'x86_64','arm64-v8a' //不支持armeabi
  29. }
  30. }
  31. sourceSets {
  32. main {
  33. jniLibs.srcDirs = ['libs']
  34. }
  35. }
  36. signingConfigs {
  37. debug {
  38. keyAlias 'zkjc_police'
  39. keyPassword 'jlszkjc777888'
  40. storeFile file("../sign/keystore.jks")
  41. storePassword 'jlszkjc777888'
  42. // v2SigningEnabled false
  43. }
  44. release {
  45. keyAlias 'zkjc_police'
  46. keyPassword 'jlszkjc777888'
  47. storeFile file("../sign/keystore.jks")
  48. storePassword 'jlszkjc777888'
  49. // v2SigningEnabled false
  50. }
  51. }
  52. buildTypes {
  53. debug {
  54. buildConfigField "boolean", "LOG_DEBUG", "true"
  55. buildConfigField "boolean", "USE_CANARY", "true"
  56. minifyEnabled false
  57. proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
  58. }
  59. release {
  60. buildConfigField "boolean", "LOG_DEBUG", "false"
  61. buildConfigField "boolean", "USE_CANARY", "false"
  62. /*minifyEnabled false
  63. shrinkResources true
  64. zipAlignEnabled true*/
  65. proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
  66. }
  67. }
  68. //此处配置必须添加 否则无法正确运行
  69. aaptOptions {
  70. additionalParameters '--auto-add-overlay'
  71. //noCompress 'foo', 'bar'
  72. ignoreAssetsPattern "!.svn:!.git:.*:!CVS:!thumbs.db:!picasa.ini:!*.scc:*~"
  73. }
  74. productFlavors {
  75. //应用商店版本
  76. sqjw {
  77. resValue "string", "app_name", "社区警务"
  78. signingConfig signingConfigs.release
  79. manifestPlaceholders = [UMENG_CHANNEL: "sqjw", CATEGORY: "android.intent.category.DEFAULT", APP_ICON: "@mipmap/ic_launcher"]
  80. }
  81. //非应用商店版本
  82. jdrh {
  83. resValue "string", "app_name", "警地融合"
  84. signingConfig signingConfigs.release
  85. manifestPlaceholders = [UMENG_CHANNEL: "jdrh", CATEGORY: "android.intent.category.LAUNCHER", APP_ICON: "@mipmap/ic_launcher"]
  86. }
  87. }
  88. productFlavors.all { flavor ->
  89. flavor.manifestPlaceholders = [UMENG_CHANNEL_VALUE: name, CATEGORY_VALUE: flavor.manifestPlaceholders.CATEGORY, APP_ICON: flavor.manifestPlaceholders.APP_ICON]
  90. // flavor.manifestPlaceholders = [UMENG_CHANNEL_VALUE: name]
  91. }
  92. applicationVariants.all { variant ->
  93. variant.outputs.all {
  94. if (variant.buildType.name == 'release') {
  95. // release:输出文件名必须命名为 outputFileName
  96. outputFileName = "${variant.productFlavors[0].name}_${variant.productFlavors[0].applicationId}_${buildType.name}_v${variant.versionName}_${releaseTime()}.apk"
  97. // output.outputFile = new File(output.outputFile.parent, apkName)
  98. } else {
  99. // debug 输出文件名必须命名为 outputFileName
  100. outputFileName = "${variant.productFlavors[0].name}_${project.getName()}_${buildType.name}.apk"
  101. // output.outputFile = new File(output.outputFile.parent, apkName)
  102. }
  103. }
  104. }
  105. configurations.all {
  106. resolutionStrategy {
  107. force 'androidx.core:core-ktx:1.6.0'
  108. }
  109. }
  110. lintOptions {
  111. disable 'InvalidPackage'
  112. disable "ResourceType"
  113. abortOnError false
  114. }
  115. }
  116. repositories {
  117. flatDir {
  118. dirs 'libs', '../common/libs'
  119. }
  120. }
  121. dependencies {
  122. implementation fileTree(dir: 'libs', include: ['*.jar'])
  123. implementation fileTree(include: ['*.aar'], dir: 'libs')
  124. // implementation 'me.jessyan:arms:2.5.2'
  125. // implementation 'me.jessyan:arms-imageloader-glide:2.5.2'
  126. //view
  127. implementation rootProject.ext.dependencies["autosize"]
  128. annotationProcessor(rootProject.ext.dependencies["butterknife-compiler"]) {
  129. exclude module: 'support-annotations'
  130. }
  131. //tools
  132. annotationProcessor rootProject.ext.dependencies["dagger2-compiler"]
  133. //注意 Arms 核心库现在并不会依赖某个 EventBus, 要想使用 EventBus, 还请在项目中自行依赖对应的 EventBus
  134. //现在支持两种 EventBus, greenrobot 的 EventBus 和畅销书 《Android源码设计模式解析与实战》的作者 何红辉 所作的 AndroidEventBus
  135. //依赖后 Arms 会自动检测您依赖的 EventBus 并自动注册
  136. //建议使用 AndroidEventBus, 特别是组件化项目, 原因请看 https://github.com/hehonghui/AndroidEventBus/issues/49
  137. //这种做法可以让使用者有自行选择三方库的权利, 并且还可以减轻 Arms 的体积
  138. // implementation rootProject.ext.dependencies["androideventbus"]implementation rootProject.ext.dependencies["eventbus"]
  139. //test
  140. debugImplementation rootProject.ext.dependencies["canary-debug"]
  141. releaseImplementation rootProject.ext.dependencies["canary-release"]
  142. testImplementation rootProject.ext.dependencies["canary-release"]
  143. testImplementation rootProject.ext.dependencies["junit"]
  144. implementation project(':thirdparty')
  145. implementation project(':common')
  146. implementation project(':downloaderHelper')
  147. implementation rootProject.ext.dependencies["recyclerview-v7"]
  148. implementation rootProject.ext.dependencies["support-v4"]
  149. implementation rootProject.ext.dependencies["appcompat-v7"]
  150. implementation rootProject.ext.dependencies["fastjson"]
  151. implementation rootProject.ext.dependencies["fresco"]
  152. implementation rootProject.ext.dependencies["picasso"]
  153. implementation rootProject.ext.dependencies["animated-gif"]
  154. implementation rootProject.ext.dependencies["webpsupport"]
  155. implementation rootProject.ext.dependencies["animated-webp"]
  156. implementation rootProject.ext.dependencies["glide"]
  157. implementation rootProject.ext.dependencies["multidex"]
  158. implementation 'androidx.webkit:webkit:1.3.0'
  159. }