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.huntersun.vkyes.etcopencard' // 仅保留中文语种的资源 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 + '"') } signingConfigs { release { storeFile file('C:/android/Android_xm_0.1/sjc/key0.jks') storePassword '123456' keyAlias 'key0' keyPassword '123456' } } // 构建配置:https://developer.android.google.cn/studio/build/build-variants buildTypes { debug { // 给包名添加后缀 applicationIdSuffix '' // 调试模式开关 debuggable true jniDebuggable true // 压缩对齐开关 zipAlignEnabled false // 移除无用的资源 shrinkResources false // 代码混淆开关 minifyEnabled false // 签名信息配置 // 添加清单占位符 addManifestPlaceholders([ 'app_name' : '九州ETC业务员' // 'app_name' : '亿速行' ]) // 调试模式下只保留一种架构的 so 库,提升打包速度 ndk { abiFilters 'armeabi-v7a' } } preview.initWith(debug) preview { applicationIdSuffix '' // 添加清单占位符 addManifestPlaceholders([ 'app_name' : '九州ETC业务员' ]) } release { // 给包名添加后缀 applicationIdSuffix '' // 调试模式开关 debuggable false jniDebuggable true // 压缩对齐开关 zipAlignEnabled false // 移除无用的资源 shrinkResources false // 代码混淆开关 minifyEnabled false // 添加清单占位符 addManifestPlaceholders([ 'app_name' : '@string/app_name' ]) // 仅保留两种架构的 so 库,根据 Bugly 统计得出 ndk { // armeabi:万金油架构平台(占用率:0%) // armeabi-v7a:曾经主流的架构平台(占用率:10%) // arm64-v8a:目前主流架构平台(占用率:95%) abiFilters 'armeabi-v7a', 'arm64-v8a' } signingConfig signingConfigs.release } } // lintOptions { // checkReleaseBuilds false // abortOnError false // } packagingOptions { // 剔除这个包下的所有文件(不会移除签名信息) exclude 'META-INF/*******' } // AOP 配置(exclude 和 include 二选一) // 需要进行配置,否则就会引发冲突,具体表现为: // 第一种:编译不过去,报错:java.util.zip.ZipException:Cause: 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' } } buildFeatures { viewBinding = true } repositories { flatDir { dirs 'libs' } } } // 添加构建依赖项: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') // 友盟封装 implementation project(':library:umeng') // OBU封装 implementation project(':library:obublelib') //车牌键盘 implementation project(':library:keyboard') // 权限请求框架: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:6.0' // AOP 插件库:https://mvnrepository.com/artifact/org.aspectj/aspectjrt implementation 'org.aspectj:aspectjrt:1.9.7' // 图片加载框架:https://github.com/bumptech/glide // 官方使用文档:https://github.com/Muyangmin/glide-docs-cn implementation 'com.github.bumptech.glide:glide:4.12.0' implementation 'androidx.appcompat:appcompat:1.3.1' implementation 'androidx.constraintlayout:constraintlayout:2.0.4' androidTestImplementation 'junit:junit:4.12' annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0' // 沉浸式框架:https://github.com/gyf-dev/ImmersionBar implementation 'com.gyf.immersionbar:immersionbar:3.0.0' // 手势 ImageView:https://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' // 日志打印框架: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' // 腾讯 MMKV:https://github.com/Tencent/MMKV implementation 'com.tencent:mmkv-static:1.2.10' // 内存泄漏监测框架:https://github.com/square/leakcanary // debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.7' // previewImplementation 'com.squareup.leakcanary:leakcanary-android:2.7' //RecyclerView最好的适配器,让你的适配器一目了然,告别代码冗余 implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.50' //标准类型转换器(用于Retrofit的上传问题) implementation 'com.squareup.retrofit2:converter-scalars:2.8.1' //FastJson解析 implementation 'org.ligboy.retrofit2:converter-fastjson-android:2.2.0' //Retrofit(网络请求框架) implementation 'com.squareup.retrofit2:retrofit:2.8.1' implementation 'com.squareup.retrofit2:converter-gson:2.8.1' //retrofit添加RxJava支持 //retrofit rxjava implementation 'io.reactivex:rxjava:1.3.8' implementation 'com.squareup.retrofit2:adapter-rxjava:2.8.1' implementation 'io.reactivex:rxandroid:1.2.1' //缓存 implementation 'com.squareup.okhttp3:logging-interceptor:4.5.0' implementation 'com.squareup.okhttp3:okhttp:4.5.0' //rxjava implementation 'io.reactivex.rxjava2:rxjava:2.1.9' implementation 'io.reactivex.rxjava2:rxandroid:2.0.2' //二维码生成 https://blog.csdn.net/xch_yang/article/details/82147461 implementation 'com.google.zxing:core:3.3.3' //事件总线 https://github.com/JeremyLiao/LiveEventBus implementation 'io.github.jeremyliao:live-event-bus-x:1.8.0' //https://blog.csdn.net/developer_min/article/details/108998795 implementation 'androidx.multidex:multidex:2.0.1' // 工具类:https://github.com/Blankj/AndroidUtilCode implementation 'com.blankj:utilcodex:1.31.0' //https://github.com/Curzibn/Luban implementation 'top.zibin:Luban:1.1.8' //https://github.com/RuffianZhong/RWidgetHelper implementation 'com.github.RuffianZhong:RWidgetHelper:androidx.v0.0.13' //身份证虚影校验 OpenCV 库进行图像处理 // implementation 'org.opencv:opencv-android:4.5.4' // //注释掉原有bugly的仓库 // //compile 'com.tencent.bugly:crashreport:latest.release'//其中latest.release指代最新版本号,也可以指定明确的版本号,例如2.3.2 // implementation 'com.tencent.bugly:crashreport_upgrade:1.2.0'//其中latest.release指代最新版本号,也可以指定明确的版本号,例如1.2.0 // implementation 'com.tencent.bugly:nativecrashreport:1.2.0' //其中latest.release指代最新版本号,也可以指定明确的版本号,例如2.2.0 // 二维码:https://github.com/bingoogolapple/BGAQRCode-Android // 多语种:https://github.com/getActivity/MultiLanguages // 悬浮窗:https://github.com/getActivity/XToast // 日志输出:https://github.com/getActivity/Logcat // 跑马灯: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 }