build.gradle 11 KB

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