build.gradle 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  1. apply plugin: 'com.android.application'
  2. buildscript {
  3. ext {
  4. appId = 'com.liaobo.im' // app的包名,
  5. channel = 'client' // bugly上显示的渠道名,
  6. wechatAppId = 'wx90c3b1a5fef18e16' // 微信相关的appId,wx373339ef4f3cd807
  7. // baiduApiKey = '17Oc8gfZjEwO9O36x6Z7VLPhG2Oe7BOb' // baidu配置的apiKey,
  8. baiduApiKey = 'xeinF1wQWj26Y1n5642KQnSvdA18sc8k' // baidu配置的apiKey,
  9. buglyAppId = '3e0dc6ee26' // bugly配置的appId,
  10. googleApiKey = 'AIzaSyAbJjDWUPU6sRsQccNMp8E3soO7YGSkTIg' // google地图配置的apiKey,
  11. xiaomiAppId = '2882303761518029709' // 小米推送配置的appId,
  12. xiaomiAppKey = '5751802928709' // 小米推送配置的appKey,
  13. huaweiAppId = '100565571' // 华为推送配置的appId,
  14. meizuAppId = '118639' // 魅族推送配置的appId,
  15. meizuAppKey = '198cfa2fa66544ba87ab05874ba22868' // 魅族推送配置的appKey,
  16. vivoAppId = '10923' // VIVO推送配置的appId,
  17. vivoAppKey = '4726232c-298c-4ce4-ac5d-0d311412a456' // VIVO推送配置的appKey,
  18. oppoAppKey = 'dIHycN8J0NsCokwSGss8sskw4' // OPPO推送配置的appKey,
  19. oppoAppSecret = 'b9f6927d9eCD0159532dA5c2e1118eC8' // OPPO推送配置的secret,
  20. buglyAppChannel = channel
  21. date = new Date().format("yyyyMMdd")
  22. buglyVersionNameSuffix = '' + '-' + date
  23. }
  24. }
  25. // 判断存在谷歌服务配置文件才启用谷歌服务,
  26. def googleJson = file('google-services.json')
  27. if (googleJson.exists() && googleJson.readLines().any { it.contains(appId) }) {
  28. apply plugin: 'com.google.gms.google-services'
  29. // 谷歌服务4.2版本有已知bug会导致其他无关依赖(smack4.3.4)莫名冲突,禁用相关检查解决,
  30. // https://github.com/invertase/react-native-firebase/issues/1676
  31. //noinspection UnnecessaryQualifiedReference
  32. com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
  33. }
  34. android {
  35. lintOptions {
  36. abortOnError false
  37. checkReleaseBuilds false
  38. }
  39. compileSdkVersion compile_version
  40. defaultConfig {
  41. applicationId appId
  42. versionCode 581
  43. versionName "5.8.1"
  44. minSdkVersion min_version
  45. targetSdkVersion target_version
  46. ndk {
  47. abiFilters "armeabi", "armeabi-v7a", "x86"
  48. // abiFilters "armeabi", "armeabi-v7a", "arm64-v8a", "x86"
  49. }
  50. multiDexEnabled = true
  51. buildConfigField('String', "BUGLY_APP_ID", '"' + buglyAppId + '"')
  52. buildConfigField('String', "BUGLY_APP_CHANNEL", '"' + buglyAppChannel + '"')
  53. buildConfigField('String', "XIAOMI_APP_ID", '"' + xiaomiAppId + '"')
  54. buildConfigField('String', "XIAOMI_APP_KEY", '"' + xiaomiAppKey + '"')
  55. buildConfigField('String', "MEIZU_APP_ID", '"' + meizuAppId + '"')
  56. buildConfigField('String', "MEIZU_APP_KEY", '"' + meizuAppKey + '"')
  57. buildConfigField('String', "OPPO_APP_KEY", '"' + oppoAppKey + '"')
  58. buildConfigField('String', "OPPO_APP_SECRET", '"' + oppoAppSecret + '"')
  59. buildConfigField('String', "GOOGLE_API_KEY", '"' + googleApiKey + '"')
  60. buildConfigField('String', "WECHAT_APP_ID", '"' + wechatAppId + '"')
  61. manifestPlaceholders = [
  62. APP_ID : appId,
  63. BAIDU_API_KEY : baiduApiKey,
  64. VIVO_APP_ID : vivoAppId,
  65. VIVO_APP_KEY : vivoAppKey,
  66. GOOGLE_API_KEY: googleApiKey,
  67. HUAWEI_APP_ID : huaweiAppId,
  68. ]
  69. }
  70. // 复制apk和mapping到项目中的release目录下,方便上传mapping到bugly,
  71. def releaseBuglyAppVersion = android.defaultConfig.versionName + buglyVersionNameSuffix
  72. applicationVariants.all { variant ->
  73. if (variant.buildType.name == 'release') {
  74. variant.assemble.doLast {
  75. copy {
  76. from variant.outputs[0].outputFile
  77. into "${rootDir}/release"
  78. rename { String fileName ->
  79. "$channel-$releaseBuglyAppVersion-${variant.name}.apk"
  80. }
  81. }
  82. if (variant.mappingFile != null) {
  83. copy {
  84. from variant.mappingFile
  85. into "${rootDir}/release"
  86. rename { String fileName ->
  87. "$channel-mapping-$releaseBuglyAppVersion-${variant.name}.txt"
  88. }
  89. }
  90. }
  91. }
  92. }
  93. }
  94. // multiDex的一些相关配置,这样配置可以让你的编译速度更快
  95. dexOptions {
  96. // 让它不要对Lib做preDexing
  97. preDexLibraries = false
  98. // 开启incremental dexing,优化编译效率,这个功能android studio默认是关闭的
  99. // incremental true
  100. // 增加java堆内存大小
  101. javaMaxHeapSize "4g"
  102. }
  103. // 进行JAVA 的版本配置,使用对应版本的一些新特性
  104. compileOptions {
  105. sourceCompatibility JavaVersion.VERSION_1_8
  106. targetCompatibility JavaVersion.VERSION_1_8
  107. }
  108. useLibrary 'org.apache.http.legacy'
  109. packagingOptions {
  110. exclude 'META-INF/LICENSE.txt'
  111. exclude 'META-INF/NOTICE.txt'
  112. }
  113. buildTypes {
  114. release {
  115. minifyEnabled false
  116. // shrinkResources true
  117. // 混淆文件位置
  118. proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
  119. buildConfigField('String', "VERSION_NAME_SUFFIX", '"' + buglyVersionNameSuffix + '"')
  120. }
  121. debug {
  122. // shrinkResources true
  123. buildConfigField('String', "VERSION_NAME_SUFFIX", '"' + "-DEBUG" + '"')
  124. }
  125. }
  126. // 签名信息从signing.properties中获取,
  127. // debug和release使用相同签名,以便用debug包覆盖release包从而调试,
  128. // 如果没有,就会使用默认debug签名,
  129. def signingFile = rootProject.file('signing.properties')
  130. if (signingFile.exists()) {
  131. def input = signingFile.newInputStream()
  132. def p = new Properties()
  133. p.load(input)
  134. // 签名文件存在才配置签名,
  135. def jks = rootProject.file(p ['storeFile'])
  136. if (jks.exists()) {
  137. signingConfigs {
  138. config {
  139. keyAlias p['keyAlias']
  140. keyPassword p['keyPassword']
  141. storeFile jks
  142. storePassword p['storePassword']
  143. v1SigningEnabled true
  144. v2SigningEnabled true
  145. }
  146. }
  147. buildTypes {
  148. debug {
  149. signingConfig signingConfigs.config
  150. }
  151. release {
  152. signingConfig signingConfigs.config
  153. }
  154. }
  155. }
  156. }
  157. }
  158. dependencies {
  159. implementation 'com.android.support:appcompat-v7:28.0.0'
  160. testImplementation 'junit:junit:4.12'
  161. implementation 'com.android.support:appcompat-v7:' + support_version
  162. implementation 'com.android.support:design:' + support_version
  163. implementation 'com.android.support:recyclerview-v7:' + support_version
  164. implementation 'com.android.support:gridlayout-v7:' + support_version
  165. implementation 'com.android.support:cardview-v7:' + support_version
  166. implementation 'com.android.support.constraint:constraint-layout:1.0.2'
  167. implementation 'com.android.support:multidex:1.0.0'
  168. implementation 'com.squareup.okhttp3:okhttp:3.2.0'
  169. implementation 'com.github.bumptech.glide:glide:3.7.0'
  170. implementation 'de.greenrobot:eventbus:3.0.0-beta1'
  171. implementation files('libs/android-async-http-1.4.5.jar')
  172. implementation files('libs/BaiduLBS_Android.jar')
  173. implementation files('libs/fastjson-1.2.40.jar')
  174. implementation files('libs/httpmime-4.2.jar')
  175. implementation files('libs/nineoldandroids.jar')
  176. implementation files('libs/ormlite-android-4.48.jar')
  177. implementation files('libs/ormlite-core-4.48.jar')
  178. implementation files('libs/pinyin4j-2.5.0.jar')
  179. implementation files('libs/universal-image-loader-1.9.0.jar')
  180. implementation files('libs/volley.jar')
  181. // 微信支付/分享,
  182. implementation 'com.tencent.mm.opensdk:wechat-sdk-android-with-mta:1.0.2'
  183. // 支付宝 SDK AAR 包所需的配置
  184. implementation(name: 'alipaySdk-15.5.9-20181123210601', ext: 'aar')
  185. // 小米推送,
  186. implementation files('libs/MiPush_SDK_Client_3_6_18.jar')
  187. // 华为推送,
  188. implementation 'com.huawei.android.hms:push:2.5.2.300'
  189. implementation 'com.huawei.android.hms:base:2.5.2.300'
  190. // 魅族推送,
  191. implementation 'com.meizu.flyme.internet:push-internal:3.8.1@aar'
  192. // vivo推送,
  193. implementation files('libs/vivopushsdk_v2.3.4.jar')
  194. // oppo推送,
  195. implementation files('libs/mcssdk-1.0.1.jar')
  196. // firebase,
  197. implementation 'com.google.firebase:firebase-core:16.0.9'
  198. implementation 'com.google.firebase:firebase-messaging:18.0.0'
  199. // 下拉刷新、视频播放、扫一扫
  200. implementation project(':pullToRefershLibraryMy')
  201. implementation project(':jcvideoplayer-lib')
  202. implementation project(':YZxing-lib')
  203. implementation(name: 'lottie-2.6.0', ext: 'aar')
  204. // 拍照录像
  205. // implementation project(path: ':cameralibrary')
  206. // implementation project(path: ':filterlibrary')
  207. implementation project(':OpenGLlibrary')
  208. // 直播相关...
  209. // 音视频
  210. // 音视频使用jwt传递用户信息,
  211. implementation 'io.jsonwebtoken:jjwt:0.9.1'
  212. // 谷歌地图
  213. // 谷歌服务版本15依赖support-v4版本26
  214. implementation 'com.google.android.gms:play-services-maps:16.1.0'
  215. implementation 'com.google.android.gms:play-services-location:16.0.0'
  216. // Smack
  217. implementation 'org.igniterealtime.smack:smack-android-extensions:4.3.4'
  218. implementation 'org.igniterealtime.smack:smack-experimental:4.3.4'
  219. implementation 'org.igniterealtime.smack:smack-tcp:4.3.4'
  220. // 视频缓存 + 视频处理
  221. implementation 'com.danikula:videocache:2.7.1'
  222. // implementation 'com.github.yangjie10930:EpMedia:v0.9.5'
  223. implementation(name: 'EpMedia-v0.9.5', ext: 'aar')
  224. // 图片压缩
  225. implementation 'top.zibin:Luban:1.1.3'
  226. // Bitmap二级缓存库
  227. implementation('com.github.chrisbanes.bitmapcache:library:2.3') {
  228. exclude group: 'com.google.android', module: 'support-v4'
  229. }
  230. // 数据库调试库,仅限debug包生效,
  231. implementation 'com.android.support:support-v4:28.0.0'
  232. debugImplementation 'com.amitshekhar.android:debug-db:1.0.6'
  233. // bugly上报,没配置自动上传mapping,因为测试时自动上传mapping失败,
  234. implementation 'com.tencent.bugly:crashreport:2.6.6'
  235. // HTML解析器
  236. implementation 'org.jsoup:jsoup:1.10.3'
  237. // 进程保护
  238. implementation 'com.fanjun:keeplive:1.1.10'
  239. // 角标
  240. implementation "me.leolin:ShortcutBadger:1.1.22"
  241. // 图片编辑库
  242. implementation 'cc.aoeiuv020:imaging:1.0'
  243. // 流式布局
  244. implementation 'com.hyman:flowlayout-lib:1.1.2'
  245. // 带header和footer的GridView
  246. implementation 'in.srain.cube:grid-view-with-header-footer:1.0.12'
  247. // 仿ios按钮
  248. implementation 'com.github.zcweng:switch-button:0.0.3@aar'
  249. // 带数字的进度条
  250. implementation 'com.daimajia.numberprogressbar:library:1.4@aar'
  251. // 六位数字密码框
  252. implementation 'com.jungly:gridPasswordView:0.3'
  253. // 靠谱点的圆形视图库
  254. implementation 'com.makeramen:roundedimageview:2.3.0'
  255. implementation(name: 'xjgarsdklibrary-release-9.1.0-2018-08-16', ext: 'aar')
  256. // 表格面板视图,https://github.com/ceryle/FitGridView
  257. implementation 'com.github.ceryle:FitGridView:v1.0.5'
  258. // 仿ios右划返回上一页,
  259. implementation 'me.imid.swipebacklayout.lib:library:1.1.0'
  260. // 支持侧滑的recyclerView,
  261. implementation project(':swiperecyclerview')
  262. // 下拉刷新布局,
  263. implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0-alpha-28'
  264. implementation 'com.google.code.gson:gson:2.8.4'
  265. implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.50'
  266. }
  267. configurations {
  268. all*.exclude group: 'xpp3', module: 'xpp3'
  269. }