原文:https://www.jianshu.com/p/0fe985a7e17e

项目中不同Module的support包版本冲突怎么办?

只需要将以下代码复制到每个模块的build.gradle(Module:xxx)文件的根目录即可:

  1. // 统一当前Module的所有support包版本
  2. configurations.all {
  3. resolutionStrategy.eachDependency { DependencyResolveDetails details ->
  4. def requested = details.requested
  5. if (requested.group == 'com.android.support') {
  6. if (!requested.name.startsWith("multidex")) {
  7. details.useVersion '28.0.0'
  8. }
  9. }
  10. }
  11. }

模板代码如下:

  1. apply plugin: 'com.android.application'
  2. android {
  3. compileSdkVersion 28
  4. defaultConfig {
  5. ...
  6. }
  7. buildTypes {
  8. ...
  9. }
  10. lintOptions {
  11. ...
  12. }
  13. }
  14. dependencies {
  15. ...
  16. }
  17. configurations.all {
  18. resolutionStrategy.eachDependency { DependencyResolveDetails details ->
  19. def requested = details.requested
  20. if (requested.group == 'com.android.support') {
  21. if (!requested.name.startsWith("multidex")) {
  22. details.useVersion '28.0.0'
  23. }
  24. }
  25. }
  26. }
 

解决com.android.support版本冲突问题的更多相关文章

  1. spring maven项目解决依赖jar包版本冲突方案

    引入:http://blog.csdn.net/sanzhongguren/article/details/71191290 在spring reference中提到一个解决spring jar包之间 ...

  2. Android Studio中依赖第三库导致support版本冲突解决方案

    1.今天在Android Studio的app/gradle文件中依赖文件选择器的第三方库:“com.leon:lfilepickerlibrary:1.8.0” 时,github地址:https:/ ...

  3. 在Visual Studio 中使用 <AutoGenerateBindingRedirects> 来解决引用的程序集版本冲突问题

    问题: https://stackoverflow.com/questions/42836248/using-autogeneratebindingredirects-in-visual-studio ...

  4. 解决shiro和quartz2 版本冲突问题

    修改build.gradle   compile ("org.quartz-scheduler:quartz:2.2.3") compile ("org.apache.s ...

  5. 11:如何解决Maven的Jar版本冲突问题

    右键 Exclude,排除冲突包

  6. com.android.support冲突的解决办法

    All com.android.support libraries must use the exact same version specification (mixing versions can ...

  7. android.support.design库的引用和冲突解决

    android.support.design库的引用和冲突解决 转 https://www.jianshu.com/p/2a0a2af9f2b4 最近在工程中使用到android.support.de ...

  8. android support的作用及其常见错误的解决

    *:first-child { margin-top: 0 !important; } body>*:last-child { margin-bottom: 0 !important; } /* ...

  9. Gradle 同步时报错,Could not find com.android.support.constraint:constraint-layout:1.0.0-alpha8的解决方法

    Error:Could not find com.android.support.constraint:constraint-layout:1.0.0-alpha8. 原因: SDK 中可能是没有安装 ...

随机推荐

  1. DB2备份恢复schema

    场景:日常中开发同步生成环境或者环境切换都需要进行表结构.存储.数据等等的迁移,本文为表.视图.包.函数.存储等统一备份及恢复的操作. 备份: 登录数据库所在服务器,或者可远程连接需备份数据库的服务器 ...

  2. [dev][ipsec][distributed] strongswan如何做热迁移/高可用/High Availability

    问题描述: 原生的基于kernel 的 strongswan 如何做高可用,HA,High Availability 问题分析: 基于我们已知的,ipsec,strongswan的知识.问题分解如下: ...

  3. What is URL Encoding and How does it work?

    Introduction A URL (Uniform Resource Locator) is the address of a resource in the world wide web. UR ...

  4. RabbitMQ3 单机及集群安装配置及优化

    一.操作系统需求及配置 # 1.1.操作系统推荐配置 4C*8G*40G磁盘 # 1.2.内核参数优化 # 系统参数需要留有swap空间,rabbitmq 启动进程用户打开文件数至少需要5万,yum安 ...

  5. JAVA系列:浅谈Java中的equals和==

    在初学Java时,可能会经常碰到下面的代码: 1 String str1 = new String("hello"); 2 String str2 = new String(&qu ...

  6. 定时器 间隔调用setInterval

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  7. markdown 显示图片的三种方式

    插入网络图片 插入本地图片 base64 图片(data:image/png;base64,iVBORw0KG........) ps:base64编码的图片可以通过站长工具编码 https://to ...

  8. html中的table导出Excel (亲测有用(●'◡'●))

    演示地址: http://www.jq22.com/yanshi3312 具体代码: <!DOCTYPE html> <html lang="zh-CN"> ...

  9. 坑爹的IE8

    1.不能用trim(),要用$.trim()    var aa = $("#id").val().trim()  这样素不行的,要变成这样Jquery的方式 var aa = $ ...

  10. leetcode解题报告(16):Move Zeroes

    描述 Given an array nums, write a function to move all 0's to the end of it while maintaining the rela ...