抛弃建立ext方式统一版本依赖,拥抱更方便的统一版本信息和依赖库版本号的新方式
抛弃建立ext方式统一版本依赖,拥抱更方便的统一版本信息和依赖库版本号的新方式
第一步:跟老方式一样,创建一个新的gradle文件,姑且叫dependences.gradle
文件内容更普通的build.gradle没有什么不一样,我们在dependencies {} 内添加我们通用的依赖,同时可以配置其他共用属性apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlin-kapt' //apply from: "../dependences.gradle" android {compileSdkVersion 29buildToolsVersion "29.0.3"defaultConfig {minSdkVersion 24targetSdkVersion 29versionCode 1versionName "1.0"testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"consumerProguardFiles 'consumer-rules.pro'}buildTypes {release {minifyEnabled falseproguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'}}} repositories {maven {url 'https://maven.google.com/'name 'Google'}maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }maven { url 'https://dl.bintray.com/umsdk/release' }maven { url 'https://jitpack.io' } } dependencies {implementation fileTree(dir: 'libs', include: ['*.jar'])implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"//testtestImplementation 'junit:junit:4.13'androidTestImplementation 'androidx.test.ext:junit:1.1.1'androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'//androidximplementation 'androidx.appcompat:appcompat:1.1.0'implementation 'androidx.core:core-ktx:1.2.0'implementation 'com.google.android.material:material:1.2.0-alpha06'implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"implementation 'androidx.cardview:cardview:1.0.0'implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta4'implementation 'androidx.legacy:legacy-support-v4:1.0.0'implementation 'androidx.appcompat:appcompat:1.1.0'implementation 'androidx.core:core-ktx:1.3.0-rc01'implementation 'androidx.legacy:legacy-support-v4:1.0.0'implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0'implementation 'androidx.preference:preference:1.1.1'implementation 'androidx.viewpager2:viewpager2:1.0.0'implementation "de.hdodenhof:circleimageview:2.1.0"implementation 'androidx.documentfile:documentfile:1.0.1'implementation 'androidx.recyclerview:recyclerview:1.1.0'implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'implementation 'androidx.navigation:navigation-fragment-ktx:2.2.2'implementation 'androidx.navigation:navigation-ui-ktx:2.2.2'implementation 'com.github.hackware1993:MagicIndicator:1.6.0'implementation "org.jetbrains.kotlin:kotlin-reflect:1.3.71"// Roomimplementation "androidx.room:room-runtime:2.2.5"kapt "androidx.room:room-compiler:2.2.5"implementation 'com.github.clans:fab:1.6.4' // implementation 'com.getbase:floatingactionbutton:1.10.1'implementation 'com.jaredrummler:colorpicker:1.1.0'//协程api 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.3'api 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.3'api "androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0"//retrofit + okHttp3api 'com.squareup.retrofit2:retrofit:2.7.0'api 'com.squareup.retrofit2:converter-gson:2.7.0'api 'com.squareup.okhttp3:logging-interceptor:4.2.2'api 'com.squareup.retrofit2:converter-scalars:2.0.0'api "com.google.code.gson:gson:2.8.6"implementation 'com.squareup.okio:okio:2.2.2'api "io.reactivex.rxjava2:rxjava:2.2.2"api 'io.reactivex.rxjava2:rxandroid:2.1.0'//SmartRefreshLayoutimplementation "com.scwang.smart:refresh-layout-kernel:2.0.0-alpha-1" //核心必须依赖implementation "com.scwang.smart:refresh-header-classics:2.0.0-alpha-1"//经典刷新头implementation "com.scwang.smart:refresh-header-radar:2.0.0-alpha-1" //雷达刷新头implementation 'com.scwang.smart:refresh-header-falsify:2.0.0-alpha-1' //虚拟刷新头implementation 'com.scwang.smart:refresh-header-material:2.0.0-alpha-1' //谷歌刷新头implementation 'com.scwang.smart:refresh-header-two-level:2.0.0-alpha-1' //二级刷新头implementation 'com.scwang.smart:refresh-footer-ball:2.0.0-alpha-1' //球脉冲加载implementation 'com.scwang.smart:refresh-footer-classics:2.0.0-alpha-1' //经典加载implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"api 'pub.devrel:easypermissions:2.0.0'api "com.jeremyliao:live-event-bus-x:1.5.7"api "com.github.bumptech.glide:glide:4.11.0"annotationProcessor "com.github.bumptech.glide:compiler:4.9.0"//umengimplementation 'com.umeng.umsdk:analytics:8.1.3'implementation 'com.umeng.umsdk:common:2.1.0'//导航implementation 'com.getkeepsafe.taptargetview:taptargetview:1.13.0'//浏览器implementation 'com.just.agentweb:agentweb:4.1.3'implementation 'com.lcodecorex:tkrefreshlayout:1.0.7'implementation 'com.github.lzyzsd:jsbridge:1.0.4'// chunk 用于网络调试debugImplementation 'com.readystatesoftware.chuck:library:1.1.0'releaseImplementation 'com.readystatesoftware.chuck:library-no-op:1.1.0'}
第二步:build.gradle下引用 dependences.gradle
引用以后我们还可以有针对的添加其他不共用的依赖或者对某一属性进行赋新值,这一点得益于gradle的属性融合(姑且叫).apply plugin: 'com.android.library' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' //引用通用配置 apply from: "../dependencies.gradle" android{defaultConfig{//修改通用配置中的属性minSdkVersion 23} } dependencies {//不共用依赖,单独添加//拼音implementation 'com.github.promeg:tinypinyin:2.0.3'implementation 'com.github.promeg:tinypinyin-lexicons-android-cncity:2.0.3'// 可选,适用于Android的中国地区词典 }
使用这种方式不但方便了依赖管理,同时方便了依赖新版本对检测以及升级,效果还是不错的.
抛弃建立ext方式统一版本依赖,拥抱更方便的统一版本信息和依赖库版本号的新方式相关推荐
- mindspore 1.3.0版本GPU环境下源码编译前的准备工作——依赖环境的安装
转载地址: 作者: 原文地址: 国产计算框架mindspore在gpu环境下编译分支r1.3,使用suod权限成功编译并安装,成功运行--(修复部分bug,给出具体编译和安装过程) 链接: https ...
- ar vr内容制作_AR和VR品牌内容:探索与观众建立联系的新方式
ar vr内容制作 We recently hosted a webinar showcasing why and how brands are using technologies such as ...
- Surface3 2+64 wifi版本重装8.1系统(疑难解答中无从‘驱动器恢复‘选项,另一种方式成功)
Surface3 重装系统 步骤详解 Surface3 2+64 wifi版本重装8.1系统(疑难解答中无从'驱动器恢复'选项,另一种方式成功) 一.u盘制作驱动器 二.安装系统 Surface3 2 ...
- 未来旅游新方式,VR云游足不出户拥抱诗和远方
突如其来的疫情给各地的旅游业都带来了很大的打击,但是也捧红了VR全景的云概念,例如云旅游.云展览以及云直播等,沉浸式云端体验也是旅游的标配了.VR全景在旅游行业的应用主要是全景图的真实展示,可以将美好 ...
- Android 开发使用 Gradle 配置构建库模块的工作方式
Android 开发过程中,我们不可避免地需要引入其他人的工作成果.减少重复"造轮子"的时间,投入到更有意义的核心任务当中. Android 库模块在结构上与 Android 应用 ...
- Salsify:高流畅度的实时视频传输新方式
与SVC不同,Salsify能即刻响应网络带宽的变化,从而调整视频帧的大小来避免网络拥堵,这样可以最大限度的保证实时视频流的流畅度.但这会带来额外的编码开销,并且由于没有硬件解码器的支持,Salsif ...
- maven 公共模块依赖_「spring-boot 源码解析」spring-boot 依赖管理
问题 maven 工程,依赖管理是非常基本又非常重要的功能,现在的工程越来越庞大,依赖越来越多,各种二方包.三方包太多太多,依赖冲突处理起来真是让人头疼,经常需要涉及到多个地方需要调整. 微信公众号: ...
- ros c++ 代码说明文档_减少运维工作量,如何通过 ROS 轻松实现资源编排新方式...
在日常工作中,我们一定遇到过需要快速构建系统的工作情形: 作为资源管理人员,需要接收一定数量以及配置的资源申请,这些申请要求网络.存储设备按需到位: 作为开发人员,需要将一套开发环境,复制一份测试环境 ...
- ros云服务器_减少运维工作量,如何通过 ROS 轻松实现资源编排新方式
在日常工作中,我们一定遇到过需要快速构建系统的工作情形: 作为资源管理人员,需要接收一定数量以及配置的资源申请,这些申请要求网络.存储设备按需到位: 作为开发人员,需要将一套开发环境,复制一份测试环境 ...
- java源码依赖分析_高德APP全链路源码依赖分析工程
一.背景 高德 App 经过多年的发展,其代码量已达到数百万行级别,支撑了高德地图复杂的业务功能.但与此同时,随着团队的扩张和业务的复杂化,越来越碎片化的代码以及代码之间复杂的依赖关系带来诸多维护性问 ...
最新文章
- 2021年春季学期-信号与系统-第十一次作业参考答案-第五小题
- 浏览器是如何工作的?(转载)
- 130242014022 蓝宏铮 第2次实验
- 2019-02-24-算法-进化
- php7 返回值,7.6.4 函数返回值
- android tab pageview,Android Fragment在ViewPager中到底经历了什么?
- 推荐一款好用的jquery弹出层插件——wbox
- centos npm install 超时报错
- JavaScript(二)基本概念
- 产生1000w不重复的数字
- windows文件自动同步
- 装黑苹果卡在苹果图标_EFI + Clover引导,已装好系统,重启进系统卡在苹果logo,似乎是显卡问题……...
- Linux (Ubuntu): bash: tailf: command not found
- 虚拟机安装未能启动服务器,虚拟机里安装Windowsserver2016,部署wsus出现无法启动和配置...
- 2012年09月12日-13日
- 2018第七届中国金融科技峰会
- 关于Canvas画布大小问题
- 微信小程序配置服务器域名和业务域名
- 一年中所有节日的排列顺序_【一年中的节日按时间顺序】时间顺序的春节风俗...
- SAP所有模块用户出口(User Exits)