build.gradle 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. apply plugin: 'com.android.application'
  2. def releaseTime() {
  3. return new Date().format("yyyyMMdd", TimeZone.getTimeZone("UTC"))
  4. }
  5. android {
  6. compileSdkVersion rootProject.ext.android["compileSdkVersion"]
  7. useLibrary 'org.apache.http.legacy'
  8. compileOptions {
  9. targetCompatibility JavaVersion.VERSION_1_8
  10. sourceCompatibility JavaVersion.VERSION_1_8
  11. }
  12. defaultConfig {
  13. applicationId "com.xwkj.wgrhc"
  14. minSdkVersion rootProject.ext.android["minSdkVersion"]
  15. targetSdkVersion 28
  16. versionCode 1
  17. versionName "1"
  18. testInstrumentationRunner rootProject.ext.dependencies["androidJUnitRunner"]
  19. flavorDimensions "1"
  20. ndk {
  21. abiFilters "armeabi", "armeabi-v7a", "arm64-v8a", "x86"
  22. }
  23. }
  24. sourceSets {
  25. main {
  26. jniLibs.srcDirs = ['libs']
  27. }
  28. }
  29. signingConfigs {
  30. debug {
  31. keyAlias 'zkjc_police'
  32. keyPassword 'jlszkjc777888'
  33. storeFile file("../sign/keystore.jks")
  34. storePassword 'jlszkjc777888'
  35. // v2SigningEnabled false
  36. }
  37. release {
  38. keyAlias 'zkjc_police'
  39. keyPassword 'jlszkjc777888'
  40. storeFile file("../sign/keystore.jks")
  41. storePassword 'jlszkjc777888'
  42. // v2SigningEnabled false
  43. }
  44. }
  45. buildTypes {
  46. debug {
  47. buildConfigField "boolean", "LOG_DEBUG", "true"
  48. buildConfigField "boolean", "USE_CANARY", "true"
  49. minifyEnabled false
  50. proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
  51. }
  52. release {
  53. buildConfigField "boolean", "LOG_DEBUG", "false"
  54. buildConfigField "boolean", "USE_CANARY", "false"
  55. /*minifyEnabled false
  56. shrinkResources true
  57. zipAlignEnabled true*/
  58. proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
  59. }
  60. }
  61. productFlavors {
  62. //应用商店版本
  63. jdrh {
  64. resValue "string", "app_name", "外国人核查"
  65. signingConfig signingConfigs.release
  66. manifestPlaceholders = [UMENG_CHANNEL: "jdrh", CATEGORY: "android.intent.category.DEFAULT", APP_ICON: "@mipmap/ic_launcher"]
  67. }
  68. //非应用商店版本
  69. jdrh {
  70. resValue "string", "app_name", "外国人核查"
  71. signingConfig signingConfigs.release
  72. manifestPlaceholders = [UMENG_CHANNEL: "jdrh", CATEGORY: "android.intent.category.LAUNCHER", APP_ICON: "@mipmap/ic_launcher"]
  73. }
  74. }
  75. productFlavors.all { flavor ->
  76. flavor.manifestPlaceholders = [UMENG_CHANNEL_VALUE: name, CATEGORY_VALUE: flavor.manifestPlaceholders.CATEGORY, APP_ICON: flavor.manifestPlaceholders.APP_ICON]
  77. // flavor.manifestPlaceholders = [UMENG_CHANNEL_VALUE: name]
  78. }
  79. applicationVariants.all { variant ->
  80. variant.outputs.all {
  81. if (variant.buildType.name == 'release') {
  82. // release:输出文件名必须命名为 outputFileName
  83. outputFileName = "${variant.productFlavors[0].name}_${variant.productFlavors[0].applicationId}_${buildType.name}_v${variant.versionName}_${releaseTime()}.apk"
  84. // output.outputFile = new File(output.outputFile.parent, apkName)
  85. } else {
  86. // debug 输出文件名必须命名为 outputFileName
  87. outputFileName = "${variant.productFlavors[0].name}_${project.getName()}_${buildType.name}.apk"
  88. // output.outputFile = new File(output.outputFile.parent, apkName)
  89. }
  90. }
  91. }
  92. lintOptions {
  93. disable 'InvalidPackage'
  94. disable "ResourceType"
  95. abortOnError false
  96. }
  97. }
  98. repositories {
  99. flatDir {
  100. dirs 'libs', '../common/libs'
  101. }
  102. }
  103. dependencies {
  104. implementation fileTree(dir: 'libs', include: ['*.jar'])
  105. // implementation 'me.jessyan:arms:2.5.2'
  106. // implementation 'me.jessyan:arms-imageloader-glide:2.5.2'
  107. //view
  108. implementation rootProject.ext.dependencies["autosize"]
  109. annotationProcessor(rootProject.ext.dependencies["butterknife-compiler"]) {
  110. exclude module: 'support-annotations'
  111. }
  112. //tools
  113. annotationProcessor rootProject.ext.dependencies["dagger2-compiler"]
  114. //注意 Arms 核心库现在并不会依赖某个 EventBus, 要想使用 EventBus, 还请在项目中自行依赖对应的 EventBus
  115. //现在支持两种 EventBus, greenrobot 的 EventBus 和畅销书 《Android源码设计模式解析与实战》的作者 何红辉 所作的 AndroidEventBus
  116. //依赖后 Arms 会自动检测您依赖的 EventBus 并自动注册
  117. //建议使用 AndroidEventBus, 特别是组件化项目, 原因请看 https://github.com/hehonghui/AndroidEventBus/issues/49
  118. //这种做法可以让使用者有自行选择三方库的权利, 并且还可以减轻 Arms 的体积
  119. implementation rootProject.ext.dependencies["androideventbus"]
  120. // implementation rootProject.ext.dependencies["eventbus"]
  121. //test
  122. debugImplementation rootProject.ext.dependencies["canary-debug"]
  123. releaseImplementation rootProject.ext.dependencies["canary-release"]
  124. testImplementation rootProject.ext.dependencies["canary-release"]
  125. testImplementation rootProject.ext.dependencies["junit"]
  126. implementation project(':thirdparty')
  127. implementation project(':common')
  128. implementation 'com.github.chrisbanes.photoview:library:1.2.4'
  129. implementation(name: 'imagepicker-release', ext: 'aar')
  130. }