build.gradle 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. apply plugin: 'com.android.application'
  2. apply plugin: 'kotlin-android'
  3. apply plugin: 'kotlin-android-extensions'
  4. apply plugin: 'kotlin-kapt'
  5. apply plugin: 'realm-android'
  6. ext {
  7. //定义变量
  8. signingConfigKeyAlias = ""
  9. signingConfigKeyPassword = ""
  10. signingConfigStoreFilePath = ""
  11. signingConfigStorePassword = ""
  12. jpushAppKeyDebug = ""
  13. pgyAppIdDebug = ""
  14. baiduAppIdDebug = ""
  15. baiduSecretDebug = ""
  16. baiduAppKeyDebug = ""
  17. jpushAppKeyRelease = ""
  18. pgyAppIdRelease = ""
  19. baiduAppIdRelease = ""
  20. baiduSecretRelease = ""
  21. baiduAppKeyRelease = ""
  22. jpushIMPassword = ""
  23. buglyAppId = ""
  24. }
  25. def loadProperties() {
  26. // load properties
  27. Properties properties = new Properties()
  28. properties.load(project.rootProject.file('local.properties').newDataInputStream())
  29. project.signingConfigKeyAlias = properties.getProperty("signingConfig.keyAlias")
  30. project.signingConfigKeyPassword = properties.getProperty("signingConfig.keyPassword")
  31. project.signingConfigStoreFilePath = properties.getProperty("signingConfig.storeFilePath")
  32. project.signingConfigStorePassword = properties.getProperty("signingConfig.storePassword")
  33. //debug key
  34. //极光推送
  35. project.jpushAppKeyDebug = properties.getProperty("JPUSH_APPKEY_DEBUG")
  36. //蒲公英
  37. project.pgyAppIdDebug = properties.getProperty("PGY_APP_ID_DEBUG")
  38. //百度
  39. project.baiduAppIdDebug = properties.getProperty("BAIDU_APPID_DEBUG")
  40. project.baiduSecretDebug = properties.getProperty("BAIDU_SECRET_DEBUG")
  41. project.baiduAppKeyDebug = properties.getProperty("BAIDU_APPKEY_DEBUG")
  42. //release key
  43. project.jpushAppKeyRelease = properties.getProperty("JPUSH_APPKEY_RELEASE")
  44. project.pgyAppIdRelease = properties.getProperty("PGY_APP_ID_RELEASE")
  45. project.baiduAppIdRelease = properties.getProperty("BAIDU_APPID_RELEASE")
  46. project.baiduSecretRelease = properties.getProperty("BAIDU_SECRET_RELEASE")
  47. project.baiduAppKeyRelease = properties.getProperty("BAIDU_APPKEY_RELEASE")
  48. project.jpushIMPassword = properties.getProperty("JM_IM_USER_PASSWORD")
  49. //bugly
  50. project.buglyAppId = properties.getProperty("BUGLY_APPID")
  51. }
  52. loadProperties()
  53. task printVersionName {
  54. def v = project.property("o2.versionName").toString()
  55. println( "${v}" )
  56. }
  57. android {
  58. compileSdkVersion 26
  59. buildToolsVersion "27.0.3"
  60. sourceSets {
  61. main {
  62. jniLibs.srcDir 'libs'
  63. assets.srcDirs = ['assets']
  64. res.srcDirs = ['src/main/res', 'src/main/res/raw']
  65. }
  66. }
  67. signingConfigs {
  68. release {
  69. v1SigningEnabled true
  70. v2SigningEnabled true
  71. keyAlias project.signingConfigKeyAlias
  72. keyPassword project.signingConfigKeyPassword
  73. storeFile file(project.signingConfigStoreFilePath)
  74. storePassword project.signingConfigStorePassword
  75. }
  76. debug {
  77. v1SigningEnabled true
  78. v2SigningEnabled true
  79. keyAlias 'androiddebugkey'
  80. storeFile file('debug.keystore')
  81. keyPassword 'android'
  82. }
  83. }
  84. defaultConfig {
  85. applicationId "net.zoneland.x.bpm.mobile.v1.zoneXBPM"
  86. minSdkVersion 19
  87. targetSdkVersion 26
  88. versionCode project.property("o2.versionCode").toInteger()
  89. versionName project.property("o2.versionName").toString()
  90. multiDexEnabled true
  91. ndk {
  92. //选择要添加的对应cpu类型的.so库。
  93. abiFilters 'armeabi', 'armeabi-v7a' //, 'arm64-v8a' //, 'x86', 'x86_64'
  94. // 还可以添加 'x86', 'x86_64', 'mips', 'mips64'
  95. }
  96. multiDexKeepProguard file('multidex_keep_file.pro')
  97. vectorDrawables.useSupportLibrary = true
  98. }
  99. buildTypes {
  100. debug {
  101. signingConfig signingConfigs.debug
  102. buildConfigField "Boolean", "InnerServer", "false"
  103. buildConfigField "Boolean", "LOG_ENABLE", "true"
  104. buildConfigField "Boolean", "LOG_FILE", "true"
  105. manifestPlaceholders = [JPUSH_PKGNAME: "net.zoneland.x.bpm.mobile.v1.zoneXBPM",
  106. JPUSH_APPKEY : project.jpushAppKeyDebug,
  107. JM_IM_USER_PASSWORD : project.jpushIMPassword,
  108. PGY_APP_ID : project.pgyAppIdDebug,
  109. BAIDU_APPID : project.baiduAppIdDebug,
  110. BAIDU_SECRET : project.baiduSecretDebug,
  111. BAIDU_APPKEY : project.baiduAppKeyDebug,
  112. BUGLY_APPID : project.buglyAppId]
  113. }
  114. release {
  115. signingConfig signingConfigs.release
  116. buildConfigField "Boolean", "InnerServer", "false"
  117. buildConfigField "Boolean", "LOG_ENABLE", "false"
  118. buildConfigField "Boolean", "LOG_FILE", "true"
  119. manifestPlaceholders = [JPUSH_PKGNAME: "net.zoneland.x.bpm.mobile.v1.zoneXBPM",
  120. JPUSH_APPKEY : project.jpushAppKeyRelease,
  121. JM_IM_USER_PASSWORD : project.jpushIMPassword,
  122. PGY_APP_ID : project.pgyAppIdRelease,
  123. BAIDU_APPID : project.baiduAppIdRelease,
  124. BAIDU_SECRET : project.baiduSecretRelease,
  125. BAIDU_APPKEY : project.baiduAppKeyRelease,
  126. BUGLY_APPID : project.buglyAppId]
  127. zipAlignEnabled true //Zipalign优化
  128. minifyEnabled true //混淆
  129. proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
  130. //apk包重命名
  131. applicationVariants.all { variant ->
  132. variant.outputs.all {
  133. outputFileName = "${variant.productFlavors[0].name}-${variant.versionName}.apk"
  134. }
  135. }
  136. }
  137. }
  138. dataBinding {
  139. enabled true
  140. }
  141. android {
  142. lintOptions {
  143. abortOnError false
  144. }
  145. }
  146. lintOptions {
  147. checkReleaseBuilds false
  148. abortOnError false
  149. }
  150. //All flavors must now belong to a named flavor dimension. Learn more at https://d.android.com/r/tools/flavorDimensions-missing-error-message.html
  151. flavorDimensions "type"
  152. productFlavors {
  153. O2PLATFORM {
  154. manifestPlaceholders = [JPUSH_CHANNEL: "pgy"]
  155. }
  156. huawei {
  157. manifestPlaceholders = [JPUSH_CHANNEL: "huawei"]
  158. }
  159. xiaomi {
  160. manifestPlaceholders = [JPUSH_CHANNEL: "xiaomi"]
  161. }
  162. }
  163. }
  164. buildscript {
  165. repositories {
  166. mavenCentral()
  167. }
  168. dependencies {
  169. classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
  170. classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"
  171. }
  172. }
  173. repositories {
  174. flatDir {
  175. dirs 'libs'
  176. }
  177. }
  178. dependencies {
  179. // implementation fileTree(include: ['*.jar'], dir: 'libs')
  180. implementation files('libs/o2_auth_sdk.jar')
  181. implementation files('libs/BaiduLBS_Android.jar')
  182. implementation files('libs/bdasr_V3_20180320_9066860.jar')
  183. implementation files('libs/com.baidu.tts_2.3.1.20170808_e39ea89.jar')
  184. implementation files('libs/pgyer_sdk_2.2.2.jar')
  185. implementation files('libs/zxing.jar')
  186. implementation files('libs/picasso-2.5.2.jar')
  187. implementation files('libs/pinyin4j-2.5.0.jar')
  188. implementation files('libs/universal-image-loader-1.9.5.jar')
  189. implementation files('libs/tbs_sdk_thirdapp_v3.2.0.1104_43200.jar')
  190. implementation(name: 'material-calendarview-fancy-1.1', ext: 'aar')
  191. implementation(name: 'MGLicenseManagerSDK-0.3.1', ext: 'aar')
  192. implementation(name: 'MGFaceppSDK-0.5.2', ext: 'aar')
  193. //kotlin
  194. implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
  195. implementation "org.jetbrains.anko:anko-common:$anko_version"
  196. //support
  197. implementation('com.android.support:support-v4:26.1.0') {
  198. force = true
  199. }
  200. implementation('com.android.support:recyclerview-v7:26.1.0') {
  201. exclude module: 'support-v4'
  202. }
  203. implementation 'com.android.support:appcompat-v7:26.1.0'
  204. implementation 'com.android.support:cardview-v7:26.1.0'
  205. implementation 'com.android.support:design:26.1.0'
  206. implementation 'com.android.support.constraint:constraint-layout:1.1.3'
  207. implementation 'com.android.support:multidex:1.0.3'
  208. implementation 'com.github.PhilJay:MPAndroidChart:v2.2.4'
  209. implementation('com.github.bumptech.glide:glide:3.7.0') {
  210. force = true
  211. }
  212. implementation 'com.afollestad.material-dialogs:core:0.8.5.9'
  213. implementation 'net.muliba.fancyfilepickerlibrary:fancyfilepickerlibrary:3.0.2'
  214. implementation 'net.muliba.changeskin:changeskin:1.2.2'
  215. implementation 'io.o2oa:signatureview:1.0.0'
  216. implementation 'net.zoneland.o2.calendarview:library:1.1.2'
  217. implementation 'com.readystatesoftware.systembartint:systembartint:1.0.3'
  218. implementation 'com.facebook.shimmer:shimmer:0.1.0@aar'
  219. implementation 'com.borax12.materialdaterangepicker:library:1.9'
  220. implementation 'com.yanzhenjie:recyclerview-swipe:1.1.4'
  221. //http
  222. implementation 'com.squareup.retrofit2:retrofit:2.4.0'
  223. implementation 'com.squareup.retrofit2:converter-gson:2.2.0'
  224. implementation 'com.squareup.retrofit2:adapter-rxjava:2.0.2'
  225. implementation 'com.squareup.okhttp3:okhttp:3.11.0'
  226. implementation 'io.reactivex:rxjava:1.1.6'
  227. implementation 'io.reactivex:rxandroid:1.2.1'
  228. //bugly
  229. implementation 'com.tencent.bugly:crashreport:2.6.6'
  230. //极光推送
  231. implementation 'cn.jiguang.sdk:jpush:3.1.2'
  232. implementation 'cn.jiguang.sdk:jmessage:2.5.0'
  233. // 此处以JMessage 2.5.0 版本为例。
  234. implementation 'cn.jiguang.sdk:jcore:1.1.9'
  235. // 此处以JCore 1.1.9 版本为例。
  236. //im
  237. implementation 'com.michaelpardo:activeandroid:3.1.0-SNAPSHOT'
  238. implementation 'com.jakewharton:butterknife:8.4.0'
  239. kapt 'com.jakewharton:butterknife-compiler:8.4.0'
  240. implementation 'com.github.w446108264:AndroidEmoji:1.0.0'
  241. implementation 'com.github.chrisbanes.photoview:library:1.2.4'
  242. implementation 'com.facebook.fresco:fresco:0.8.1'
  243. implementation 'org.greenrobot:eventbus:3.0.0'
  244. implementation 'com.contrarywind:Android-PickerView:3.2.4'
  245. //滚动选择器
  246. implementation 'com.jzxiang.pickerview:TimePickerDialog:1.0.1'
  247. //google architecture component
  248. def lifecycle_version = "1.1.1"
  249. // ViewModel and LiveData
  250. implementation "android.arch.lifecycle:extensions:$lifecycle_version"
  251. // alternatively - just ViewModel
  252. implementation "android.arch.lifecycle:viewmodel:$lifecycle_version"
  253. // use -ktx for Kotlin
  254. // alternatively - just LiveData
  255. implementation "android.arch.lifecycle:livedata:$lifecycle_version"
  256. // alternatively - Lifecycles only (no ViewModel or LiveData).
  257. // Support library depends on this lightweight import
  258. implementation "android.arch.lifecycle:runtime:$lifecycle_version"
  259. annotationProcessor "android.arch.lifecycle:compiler:$lifecycle_version"
  260. //noinspection GradleDependency
  261. kapt "com.android.databinding:compiler:$gradle_version"
  262. //test
  263. testImplementation 'junit:junit:4.12'
  264. }
  265. tasks.whenTaskAdded { task ->
  266. if (task.name == "lint") {
  267. task.enabled = false
  268. }
  269. }