123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201 |
- apply plugin: 'com.android.application'
- apply plugin: 'com.xuexiang.xaop'
- apply from: "../config.gradle"
-
- android {
-
- defaultConfig {
-
- // 无痛修改包名:https://www.jianshu.com/p/17327e191d2e
- applicationId "com.hjq.demo"
-
- // 仅保留中文语种的资源
- resConfig 'zh'
-
- // 仅保留 xxhdpi 图片资源(目前主流分辨率 1920 * 1080)
- resConfig 'xxhdpi'
-
- // 仅保留两种架构的 so 库,根据 Bugly 统计得出
- ndk {
- // armeabi:万金油架构平台(占用率:0%)
- // armeabi-v7a:曾经主流的架构平台(占用率:10%)
- // arm64-v8a:目前主流架构平台(占用率:90%)
- abiFilters "armeabi-v7a", "arm64-v8a"
- }
-
- // 开启 Dex 分包
- //multiDexEnabled true
-
- // 使用矢量图支持库(为了兼容 API 21 以下)
- // 阿里巴巴矢量图库:https://www.iconfont.cn/
- vectorDrawables.useSupportLibrary = true
-
- // 混淆配置
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-app.pro'
- }
-
- // APK 签名的那些事:https://www.jianshu.com/p/a1f8e5896aa2
- signingConfigs {
- config {
- storeFile file(StoreFile)
- storePassword StorePassword
- keyAlias KeyAlias
- keyPassword KeyPassword
- }
- }
-
- buildTypes {
-
- debug {
- debuggable true
- jniDebuggable true
- // 移除无用的资源文件
- shrinkResources false
- // ZipAlign 优化
- zipAlignEnabled false
- // 设置混淆
- minifyEnabled false
- // 开发环境下的 BuglyId
- buildConfigField "String", "BUGLY_ID", "\"请自行替换 Bugly 上面的 AppID\""
- signingConfig signingConfigs.config
- }
-
- release {
- debuggable false
- jniDebuggable false
- // 移除无用的资源文件
- shrinkResources true
- // ZipAlign 优化
- zipAlignEnabled true
- // 设置混淆
- minifyEnabled true
- // 正式环境下的 BuglyId
- buildConfigField "String", "BUGLY_ID", "\"请自行替换 Bugly 上面的 AppID\""
- signingConfig signingConfigs.config
- }
- }
-
- // 默认渠道名
- flavorDimensions "default"
- // 友盟多渠道打包
- android.productFlavors {
- tencent {} // 应用宝
- baidu {} // 百度
- xiaomi {} // 小米
- huawei {} // 华为
-
- productFlavors.all { flavor ->
- flavor.manifestPlaceholders = [channel: name]
- }
- }
-
- // 执行配置
- applicationVariants.all { variant ->
-
- // Apk 输出配置
- variant.outputs.all { output ->
- outputFileName = rootProject.getName() + '_v' + variant.versionName + '_' + variant.buildType.name
- if (variant.buildType.name == buildTypes.release.getName()) {
- outputFileName += '_' + new Date().format("yyyyMMdd")
- }
- outputFileName += '.apk'
- }
- }
- }
-
- // api 与 implementation 的区别:https://www.jianshu.com/p/8962d6ba936e
- dependencies {
-
- // 基础库(不包任何第三方框架)
- implementation project(':base')
- // 自定义 View
- implementation project(':widget')
- // 友盟隔离
- implementation project(':umeng')
-
- // Dex 分包,解决 64k 方法问题
- //implementation 'androidx.multidex:multidex:2.0.1'
-
- // 网络请求框架:https://github.com/getActivity/EasyHttp
- implementation 'com.hjq:http:5.0'
-
- // 权限请求框架:https://github.com/getActivity/XXPermissions
- implementation 'com.hjq:xxpermissions:6.2'
-
- // 标题栏框架:https://github.com/getActivity/TitleBar
- implementation 'com.hjq:titlebar:6.0'
-
- // 吐司框架:https://github.com/getActivity/ToastUtils
- implementation 'com.hjq:toast:8.0'
-
- // OkHttp 框架:https://github.com/square/okhttp
- implementation 'com.squareup.okhttp3:okhttp:3.12.8'
-
- // JSON 解析框架:https://github.com/google/gson
- implementation 'com.google.code.gson:gson:2.8.6'
-
- // AOP 插件库:https://mvnrepository.com/artifact/org.aspectj/aspectjrt
- implementation 'org.aspectj:aspectjrt:1.9.5'
-
- // ButterKnife 注解库:https://github.com/JakeWharton/butterknife
- if (project.hasProperty('android.injected.invoked.from.ide')) {
- // 开发时使用运行时注解,提升 IDE 编译速度
- implementation 'com.jakewharton:butterknife-reflect:10.2.0'
- } else {
- // 打包时使用编译时注解,提升 APP 运行速度
- implementation 'com.jakewharton:butterknife:10.2.0'
- annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.0'
- }
-
- // 图片加载框架:https://github.com/bumptech/glide
- implementation 'com.github.bumptech.glide:glide:4.10.0'
- annotationProcessor 'com.github.bumptech.glide:compiler:4.10.0'
-
- // 状态栏沉浸:https://github.com/gyf-dev/ImmersionBar
- implementation 'com.gyf.immersionbar:immersionbar:3.0.0'
-
- // 手势 ImageView:https://github.com/chrisbanes/PhotoView
- implementation 'com.github.chrisbanes:PhotoView:2.3.0'
- // ViewPager 指示器:https://github.com/romandanylyk/PageIndicatorView
- implementation 'com.romandanylyk:pageindicatorview:1.0.3'
-
- // Bugly 异常捕捉:https://bugly.qq.com/docs/user-guide/instruction-manual-android/?v=20190418140644
- implementation 'com.tencent.bugly:crashreport:3.1.0'
- implementation 'com.tencent.bugly:nativecrashreport:3.7.1'
-
- // 本地异常捕捉框架:https://github.com/Ereza/CustomActivityOnCrash
- implementation 'cat.ereza:customactivityoncrash:2.2.0'
-
- // 动画解析库:https://github.com/airbnb/lottie-android
- // 动画资源:https://lottiefiles.com/
- implementation 'com.airbnb.android:lottie:3.2.0'
-
- // 上拉刷新下拉加载:https://github.com/scwang90/SmartRefreshLayout
- implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0'
- // SmartRefreshLayout 刷新样式集合库
- implementation 'com.scwang.smartrefresh:SmartRefreshHeader:1.1.0'
-
- // 侧滑框架:https://github.com/luckybilly/SmartSwipe
- implementation 'com.billy.android:smart-swipe:1.1.2'
- implementation 'com.billy.android:smart-swipe-x:1.1.0'
-
- // 日志调试:https://github.com/getActivity/Logcat
- debugImplementation 'com.hjq:logcat:3.2'
-
- // 内存泄漏:https://github.com/square/leakcanary
- debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.0'
-
- // 国际化:https://github.com/getActivity/MultiLanguages
- // 悬浮窗:https://github.com/getActivity/XToast
- // 工具类:https://github.com/Blankj/AndroidUtilCode
- // 轮播图:https://github.com/bingoogolapple/BGABanner-Android
- // 二维码:https://github.com/bingoogolapple/BGAQRCode-Android
- // 屏幕适配:https://github.com/JessYanCoding/AndroidAutoSize
- // 跑马灯:https://github.com/sunfusheng/MarqueeView
- // 第三方支付:https://github.com/Cuieney/RxPay
- // Log 打印:https://github.com/JakeWharton/timber
- // 图片裁剪:https://github.com/Yalantis/uCrop
- // 图片压缩:https://github.com/Curzibn/Luban
- // 对象存储:https://github.com/leavesC/DoKV
- // 数据注入:https://github.com/JumeiRdGroup/Parceler
- }
|