build.gradle 5.7 KB

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