DigitalAgriculture/app/build.gradle

228 lines
9.3 KiB
Groovy
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

apply plugin : 'com.android.application'
apply plugin : 'android-aspectjx'
apply from : '../common.gradle'
// Android 代码规范文档https://github.com/getActivity/AndroidCodeStandard
android {
// 资源目录存放指引https://developer.android.google.cn/guide/topics/resources/providing-resources
defaultConfig {
// 无痛修改包名https://www.jianshu.com/p/17327e191d2e
applicationId 'com.yinhetairui.digitalagriculture'
// 仅保留中文语种的资源
resConfigs 'zh'
// 仅保留 xxhdpi 图片资源(目前主流分辨率 1920 * 1080
resConfigs 'xxhdpi'
// 混淆配置
proguardFiles 'proguard-sdk.pro', 'proguard-app.pro'
// 日志打印开关
buildConfigField('boolean', 'LOG_ENABLE', '' + LOG_ENABLE + '')
// 测试包下的 BuglyId
buildConfigField('String', 'BUGLY_ID', '"' + BUGLY_ID + '"')
// 测试服务器的主机地址
buildConfigField('String', 'HOST_URL', '"' + HOST_URL + '"')
}
// Apk 签名的那些事https://www.jianshu.com/p/a1f8e5896aa2
signingConfigs {
config {
storeFile file(StoreFile)
storePassword StorePassword
keyAlias KeyAlias
keyPassword KeyPassword
}
}
// 构建配置https://developer.android.google.cn/studio/build/build-variants
buildTypes {
debug {
// 给包名添加后缀
applicationIdSuffix '.debug'
// 调试模式开关
debuggable true
jniDebuggable true
// 压缩对齐开关
zipAlignEnabled false
// 移除无用的资源
shrinkResources false
// 代码混淆开关
minifyEnabled false
// 签名信息配置
signingConfig signingConfigs.config
// 添加清单占位符
addManifestPlaceholders([
'app_name' : '数字农业 Debug 版'
])
// 调试模式下只保留一种架构的 so 库,提升打包速度
ndk {
abiFilters 'armeabi', 'armeabi-v7a', 'arm64-v8a'
}
}
preview.initWith(debug)
preview {
applicationIdSuffix ''
// 添加清单占位符
addManifestPlaceholders([
'app_name' : '数字农业 Preview 版'
])
}
release {
// 调试模式开关
debuggable false
jniDebuggable false
// 压缩对齐开关
zipAlignEnabled true
// 移除无用的资源
shrinkResources true
// 代码混淆开关
minifyEnabled true
// 签名信息配置
signingConfig signingConfigs.config
// 添加清单占位符
addManifestPlaceholders([
'app_name' : '@string/app_name'
])
// 仅保留两种架构的 so 库,根据 Bugly 统计得出
ndk {
// armeabi万金油架构平台占用率0%
// armeabi-v7a曾经主流的架构平台占用率10%
// arm64-v8a目前主流架构平台占用率95%
abiFilters 'armeabi-v7a', 'arm64-v8a'
}
}
}
packagingOptions {
// 剔除这个包下的所有文件(不会移除签名信息)
exclude 'META-INF/*******'
}
// AOP 配置exclude 和 include 二选一)
// 需要进行配置,否则就会引发冲突,具体表现为:
// 第一种编译不过去报错java.util.zip.ZipExceptionCause: zip file is empty
// 第二种编译能过去但运行时报错ClassNotFoundException: Didn't find class on path: DexPathList
aspectjx {
// 排除一些第三方库的包名Gson、 LeakCanary 和 AOP 有冲突)
// exclude 'androidx', 'com.google', 'com.squareup', 'org.apache', 'com.alipay', 'com.taobao', 'versions.9'
// 只对以下包名做 AOP 处理
include android.defaultConfig.applicationId
}
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('MMdd')
}
outputFileName += '.apk'
}
}
}
// 添加构建依赖项https://developer.android.google.cn/studio/build/dependencies
// api 与 implementation 的区别https://www.jianshu.com/p/8962d6ba936e
dependencies {
// 基类封装
implementation project(':library:base')
// 控件封装
implementation project(':library:widget')
// 权限请求框架https://github.com/getActivity/XXPermissions
implementation 'com.github.getActivity:XXPermissions:12.3'
// 标题栏框架https://github.com/getActivity/TitleBar
implementation 'com.github.getActivity:TitleBar:9.2'
// 吐司框架https://github.com/getActivity/ToastUtils
implementation 'com.github.getActivity:ToastUtils:9.5'
// 网络请求框架https://github.com/getActivity/EasyHttp
implementation 'com.github.getActivity:EasyHttp:10.2'
// OkHttp 框架https://github.com/square/okhttp
// noinspection GradleDependency
implementation 'com.squareup.okhttp3:okhttp:3.12.13'
// Json 解析框架https://github.com/google/gson
implementation 'com.google.code.gson:gson:2.8.8'
// Gson 解析容错https://github.com/getActivity/GsonFactory
implementation 'com.github.getActivity:GsonFactory:5.2'
// Shape 框架https://github.com/getActivity/ShapeView
implementation 'com.github.getActivity:ShapeView:9.2'
// AOP 插件库https://mvnrepository.com/artifact/org.aspectj/aspectjrt
implementation 'org.aspectj:aspectjrt:1.9.6'
// 图片加载框架https://github.com/bumptech/glide
// 官方使用文档https://github.com/Muyangmin/glide-docs-cn
implementation 'com.github.bumptech.glide:glide:4.12.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'
// 沉浸式框架https://github.com/gyf-dev/ImmersionBar
implementation 'com.gyf.immersionbar:immersionbar:3.0.0'
// 手势 ImageViewhttps://github.com/Baseflow/PhotoView
implementation 'com.github.Baseflow:PhotoView:2.3.0'
// Bugly 异常捕捉https://bugly.qq.com/docs/user-guide/instruction-manual-android/?v=20190418140644
implementation 'com.tencent.bugly:crashreport:3.4.4'
implementation 'com.tencent.bugly:nativecrashreport:3.9.2'
// 动画解析库https://github.com/airbnb/lottie-android
// 动画资源https://lottiefiles.com、https://icons8.com/animated-icons
implementation 'com.airbnb.android:lottie:4.1.0'
// 上拉刷新下拉加载框架https://github.com/scwang90/SmartRefreshLayout
implementation 'com.scwang.smart:refresh-layout-kernel:2.0.3'
implementation 'com.scwang.smart:refresh-header-material:2.0.3'
implementation 'com.scwang.smart:refresh-header-classics:2.0.3'
implementation 'com.scwang.smart:refresh-footer-classics:2.0.3'
// 日志打印框架https://github.com/JakeWharton/timber
implementation 'com.jakewharton.timber:timber:4.7.1'
// 指示器框架https://github.com/ongakuer/CircleIndicator
implementation 'me.relex:circleindicator:2.1.6'
// 腾讯 MMKVhttps://github.com/Tencent/MMKV
implementation 'com.tencent:mmkv-static:1.2.10'
// Android TabLayout库
implementation 'io.github.h07000223:flycoTabLayout:3.0.0'
//一个强大并且灵活的RecyclerViewAdapterhttps://github.com/CymChad/BaseRecyclerViewAdapterHelper
//RecyclerView ViewHolder复用错乱解决方案https://blog.csdn.net/qq_43278826/article/details/105146153/
implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:3.0.3'
//图片选择器
implementation 'com.github.LuckSiege.PictureSelector:picture_library:v2.6.0'
//hawk缓存数据simple key-value storage for Androidhttps://github.com/orhanobut/hawk
implementation 'com.orhanobut:hawk:2.0.1'
// 内存泄漏监测框架https://github.com/square/leakcanary
//debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.7'
//previewImplementation 'com.squareup.leakcanary:leakcanary-android:2.7'
// 多语种https://github.com/getActivity/MultiLanguages
// 悬浮窗https://github.com/getActivity/XToast
// 日志输出https://github.com/getActivity/Logcat
// 工具类https://github.com/Blankj/AndroidUtilCode
// 轮播图https://github.com/bingoogolapple/BGABanner-Android
// 二维码https://github.com/bingoogolapple/BGAQRCode-Android
// 跑马灯https://github.com/sunfusheng/MarqueeView
// 对象注解https://www.jianshu.com/p/f1f888e4a35f
// 对象存储https://github.com/leavesC/DoKV
// 多渠道打包https://github.com/Meituan-Dianping/walle
// 设备唯一标识http://msa-alliance.cn/col.jsp?id=120
// 嵌套滚动容器https://github.com/donkingliang/ConsecutiveScroller
// 隐私调用监控https://github.com/huage2580/PermissionMonitor
}