Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

build.gradle 7.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. apply plugin: 'com.android.application'
  2. apply plugin: 'com.xuexiang.xaop'
  3. apply from: "../config.gradle"
  4. android {
  5. defaultConfig {
  6. // 无痛修改包名:https://www.jianshu.com/p/17327e191d2e
  7. applicationId "com.hjq.demo"
  8. // 仅保留中文语种的资源
  9. resConfig 'zh'
  10. // 仅保留 xxhdpi 图片资源(目前主流分辨率 1920 * 1080)
  11. resConfig 'xxhdpi'
  12. // 仅保留两种架构的 so 库,根据 Bugly 统计得出
  13. ndk {
  14. // armeabi:万金油架构平台(占用率:0%)
  15. // armeabi-v7a:曾经主流的架构平台(占用率:10%)
  16. // arm64-v8a:目前主流架构平台(占用率:90%)
  17. abiFilters "armeabi-v7a", "arm64-v8a"
  18. }
  19. // 开启 Dex 分包
  20. //multiDexEnabled true
  21. // 使用矢量图支持库(为了兼容 API 21 以下)
  22. // 阿里巴巴矢量图库:https://www.iconfont.cn/
  23. vectorDrawables.useSupportLibrary = true
  24. // 混淆配置
  25. proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-app.pro'
  26. }
  27. // APK 签名的那些事:https://www.jianshu.com/p/a1f8e5896aa2
  28. signingConfigs {
  29. config {
  30. storeFile file(StoreFile)
  31. storePassword StorePassword
  32. keyAlias KeyAlias
  33. keyPassword KeyPassword
  34. }
  35. }
  36. buildTypes {
  37. debug {
  38. debuggable true
  39. jniDebuggable true
  40. // 移除无用的资源文件
  41. shrinkResources false
  42. // ZipAlign 优化
  43. zipAlignEnabled false
  44. // 设置混淆
  45. minifyEnabled false
  46. // 开发环境下的 BuglyId
  47. buildConfigField "String", "BUGLY_ID", "\"请自行替换 Bugly 上面的 AppID\""
  48. signingConfig signingConfigs.config
  49. }
  50. release {
  51. debuggable false
  52. jniDebuggable false
  53. // 移除无用的资源文件
  54. shrinkResources true
  55. // ZipAlign 优化
  56. zipAlignEnabled true
  57. // 设置混淆
  58. minifyEnabled true
  59. // 正式环境下的 BuglyId
  60. buildConfigField "String", "BUGLY_ID", "\"请自行替换 Bugly 上面的 AppID\""
  61. signingConfig signingConfigs.config
  62. }
  63. }
  64. // 默认渠道名
  65. flavorDimensions "default"
  66. // 友盟多渠道打包
  67. android.productFlavors {
  68. tencent {} // 应用宝
  69. baidu {} // 百度
  70. xiaomi {} // 小米
  71. huawei {} // 华为
  72. productFlavors.all { flavor ->
  73. flavor.manifestPlaceholders = [channel: name]
  74. }
  75. }
  76. // 执行配置
  77. applicationVariants.all { variant ->
  78. // Apk 输出配置
  79. variant.outputs.all { output ->
  80. outputFileName = rootProject.getName() + '_v' + variant.versionName + '_' + variant.buildType.name
  81. if (variant.buildType.name == buildTypes.release.getName()) {
  82. outputFileName += '_' + new Date().format("yyyyMMdd")
  83. }
  84. outputFileName += '.apk'
  85. }
  86. }
  87. }
  88. // api 与 implementation 的区别:https://www.jianshu.com/p/8962d6ba936e
  89. dependencies {
  90. // 基础库(不包任何第三方框架)
  91. implementation project(':base')
  92. // 自定义 View
  93. implementation project(':widget')
  94. // 友盟隔离
  95. implementation project(':umeng')
  96. // Dex 分包,解决 64k 方法问题
  97. //implementation 'androidx.multidex:multidex:2.0.1'
  98. // 网络请求框架:https://github.com/getActivity/EasyHttp
  99. implementation 'com.hjq:http:5.0'
  100. // 权限请求框架:https://github.com/getActivity/XXPermissions
  101. implementation 'com.hjq:xxpermissions:6.2'
  102. // 标题栏框架:https://github.com/getActivity/TitleBar
  103. implementation 'com.hjq:titlebar:6.0'
  104. // 吐司框架:https://github.com/getActivity/ToastUtils
  105. implementation 'com.hjq:toast:8.0'
  106. // OkHttp 框架:https://github.com/square/okhttp
  107. implementation 'com.squareup.okhttp3:okhttp:3.12.8'
  108. // JSON 解析框架:https://github.com/google/gson
  109. implementation 'com.google.code.gson:gson:2.8.6'
  110. // AOP 插件库:https://mvnrepository.com/artifact/org.aspectj/aspectjrt
  111. implementation 'org.aspectj:aspectjrt:1.9.5'
  112. // ButterKnife 注解库:https://github.com/JakeWharton/butterknife
  113. if (project.hasProperty('android.injected.invoked.from.ide')) {
  114. // 开发时使用运行时注解,提升 IDE 编译速度
  115. implementation 'com.jakewharton:butterknife-reflect:10.2.0'
  116. } else {
  117. // 打包时使用编译时注解,提升 APP 运行速度
  118. implementation 'com.jakewharton:butterknife:10.2.0'
  119. annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.0'
  120. }
  121. // 图片加载框架:https://github.com/bumptech/glide
  122. implementation 'com.github.bumptech.glide:glide:4.10.0'
  123. annotationProcessor 'com.github.bumptech.glide:compiler:4.10.0'
  124. // 状态栏沉浸:https://github.com/gyf-dev/ImmersionBar
  125. implementation 'com.gyf.immersionbar:immersionbar:3.0.0'
  126. // 手势 ImageView:https://github.com/chrisbanes/PhotoView
  127. implementation 'com.github.chrisbanes:PhotoView:2.3.0'
  128. // ViewPager 指示器:https://github.com/romandanylyk/PageIndicatorView
  129. implementation 'com.romandanylyk:pageindicatorview:1.0.3'
  130. // Bugly 异常捕捉:https://bugly.qq.com/docs/user-guide/instruction-manual-android/?v=20190418140644
  131. implementation 'com.tencent.bugly:crashreport:3.1.0'
  132. implementation 'com.tencent.bugly:nativecrashreport:3.7.1'
  133. // 本地异常捕捉框架:https://github.com/Ereza/CustomActivityOnCrash
  134. implementation 'cat.ereza:customactivityoncrash:2.2.0'
  135. // 动画解析库:https://github.com/airbnb/lottie-android
  136. // 动画资源:https://lottiefiles.com/
  137. implementation 'com.airbnb.android:lottie:3.2.0'
  138. // 上拉刷新下拉加载:https://github.com/scwang90/SmartRefreshLayout
  139. implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0'
  140. // SmartRefreshLayout 刷新样式集合库
  141. implementation 'com.scwang.smartrefresh:SmartRefreshHeader:1.1.0'
  142. // 侧滑框架:https://github.com/luckybilly/SmartSwipe
  143. implementation 'com.billy.android:smart-swipe:1.1.2'
  144. implementation 'com.billy.android:smart-swipe-x:1.1.0'
  145. // 日志调试:https://github.com/getActivity/Logcat
  146. debugImplementation 'com.hjq:logcat:3.2'
  147. // 内存泄漏:https://github.com/square/leakcanary
  148. debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.0'
  149. // 国际化:https://github.com/getActivity/MultiLanguages
  150. // 悬浮窗:https://github.com/getActivity/XToast
  151. // 工具类:https://github.com/Blankj/AndroidUtilCode
  152. // 轮播图:https://github.com/bingoogolapple/BGABanner-Android
  153. // 二维码:https://github.com/bingoogolapple/BGAQRCode-Android
  154. // 屏幕适配:https://github.com/JessYanCoding/AndroidAutoSize
  155. // 跑马灯:https://github.com/sunfusheng/MarqueeView
  156. // 第三方支付:https://github.com/Cuieney/RxPay
  157. // Log 打印:https://github.com/JakeWharton/timber
  158. // 图片裁剪:https://github.com/Yalantis/uCrop
  159. // 图片压缩:https://github.com/Curzibn/Luban
  160. // 对象存储:https://github.com/leavesC/DoKV
  161. // 数据注入:https://github.com/JumeiRdGroup/Parceler
  162. }