build.gradle 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. apply plugin: 'com.android.application'
  2. apply plugin: 'com.getkeepsafe.dexcount'
  3. apply plugin: 'me.tatarka.retrolambda'
  4. //定义时间
  5. def releaseTime() {
  6. return new Date().format("yyyyMMddHHmmss")
  7. }
  8. //设置发布的显示的版本号
  9. def getVersionName(){
  10. return rootProject.ext.android.versionName
  11. }
  12. android {
  13. compileOptions {
  14. sourceCompatibility JavaVersion.VERSION_1_8
  15. targetCompatibility JavaVersion.VERSION_1_8
  16. }
  17. signingConfigs {
  18. config {
  19. storeFile file('C:/sigin/applicationsignname[20150409]')
  20. storePassword '13237658359'
  21. keyAlias 'jie-20150409'
  22. keyPassword '13237658359'
  23. }
  24. }
  25. compileSdkVersion rootProject.ext.android.compileSdkVersion
  26. buildToolsVersion rootProject.ext.android.buildToolsVersion
  27. defaultConfig {
  28. applicationId project.applicationId
  29. minSdkVersion rootProject.ext.android.minSdkVersion
  30. targetSdkVersion rootProject.ext.android.targetSdkVersion
  31. versionCode rootProject.ext.android.versionCode
  32. versionName rootProject.ext.android.versionName
  33. multiDexEnabled true
  34. signingConfig signingConfigs.config
  35. manifestPlaceholders = [UMENG_CHANNEL_VALUE: "umeng"]
  36. ndk {
  37. abiFilters "armeabi", "armeabi-v7a", "x86", "mips","x86_64","mips64"
  38. }
  39. }
  40. useLibrary 'org.apache.http.legacy'
  41. lintOptions {
  42. checkReleaseBuilds false
  43. abortOnError false
  44. }
  45. packagingOptions {
  46. exclude 'META-INF/LICENSE.txt'
  47. exclude 'META-INF/NOTICE.txt'
  48. }
  49. buildTypes {
  50. release {
  51. minifyEnabled false
  52. proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
  53. signingConfig signingConfigs.config
  54. }
  55. debug {
  56. signingConfig signingConfigs.config
  57. }
  58. }
  59. // 友盟多渠道打包
  60. productFlavors {
  61. // wandoujia {}
  62. // _360 {}
  63. baidu {}
  64. // xiaomi {}
  65. // tencent {}
  66. // taobao {}
  67. }
  68. productFlavors.all {
  69. flavor -> flavor.manifestPlaceholders = [UMENG_CHANNEL_VALUE: name]
  70. }
  71. //给apk添加对应的版本号:这里暂时注释但保留
  72. //配置自定义打包名称
  73. applicationVariants.all { variant ->
  74. variant.outputs.each { output ->
  75. def outputFile = output.outputFile
  76. def fileName
  77. if (outputFile != null && outputFile.name.endsWith('.apk')) {
  78. if (variant.buildType.name.equals('release')) {
  79. variant.mergedFlavor.versionName = getVersionName()+"."+releaseTime()
  80. fileName = "UU互联_${variant.mergedFlavor.versionName}_release.apk"
  81. } else if (variant.buildType.name.equals('debug')) {
  82. variant.mergedFlavor.versionName = getVersionName()+"."+releaseTime()
  83. fileName = "UU互联_${variant.mergedFlavor.versionName}_debug.apk"
  84. }
  85. output.outputFile = new File(outputFile.parent, fileName)
  86. }
  87. }
  88. }
  89. }
  90. dependencies {
  91. compile fileTree(include: ['*.jar'], dir: 'libs')
  92. testCompile deps.junit
  93. compile deps.appcompatV7
  94. compile deps.cardviewV7
  95. compile deps.design
  96. compile(deps.stetho) {
  97. force = true
  98. }
  99. compile deps.jodatime
  100. compile deps.systembartint
  101. compile deps.photoView
  102. compile deps.tagGroup
  103. compile deps.analytics
  104. compile deps.activityOnCrash
  105. compile deps.stickyListHeaders
  106. compile deps.stickyGridHeaders
  107. compile deps.materialDialogs
  108. compile deps.okhttp
  109. androidTestCompile deps.leakcanaryNp
  110. debugCompile deps.leakcanary
  111. releaseCompile deps.leakcanaryNp
  112. //project
  113. compile project(':common')
  114. compile project(':appmessages')
  115. compile project(':network')
  116. compile project(':imageload')
  117. compile project(':applogin')
  118. compile project(':apptasks')
  119. compile project(':appcontact')
  120. compile project(':appme')
  121. compile project(':appworks')
  122. compile project(":appbooking")
  123. compile project(':android-pdf-viewer')
  124. }
  125. buildscript {
  126. repositories {
  127. mavenCentral()
  128. }
  129. dependencies {
  130. classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.6.4'
  131. }
  132. }
  133. dexcount {
  134. format = "json"
  135. includeClasses = false
  136. includeFieldCount = true
  137. includeTotalMethodCount = false
  138. orderByMethodCount = false
  139. verbose = false
  140. maxTreeDepth = Integer.MAX_VALUE
  141. teamCityIntegration = false
  142. enableForInstantRun = false
  143. }