登录

去注册 忘记密码?

登录

注册

去登录

  • 扫码关注公众号
  • 发送“我爱安卓
  • 即可获取验证码

注册

解锁回答区域

  • 扫码关注公众号
  • 发送“我爱安卓

若你登陆,将永久解锁;
若未登录,仅本机解锁。

解锁回答区域

获取注册验证码

  • 扫码关注公众号
  • 发送“我爱安卓
  • 即可获取验证码

速查 | 第三方依赖冲突

速查小编   2018-08-27 17:05   收藏 我也要投递项目>>

这里是速查系列文章之一,搜索“速查”,即刻拥有,希望添加速查内容,请在此反馈

移除某个第三方的依赖

debugImplementation ('me.ele:uetool:1.0.15'){
  exclude group: 'com.android.support', module: 'support-v7'
}

debugImplementation ('me.ele:uetool:1.0.15'){
  exclude group: 'com.android.support'
}

更加方便的方式

有时候,乱七八糟的依赖过多,可以使用如下方案:

在 app的module中:

android{
	configurations.all {
        resolutionStrategy.eachDependency { DependencyResolveDetails details ->
            def requested = details.requested
            if (requested.group == 'com.android.support') {
                if (requested.name.startsWith("appcompat-v7")) {
                    details.useVersion '25.3.0'
                }
                if (requested.name.startsWith("appcompat-v4")) {
                    details.useVersion '25.3.0'
                }

                if (requested.name.startsWith("recyclerview-v7")) {
                    details.useVersion '25.3.0'
                }
            }
        }
    }

}

这样可以强制使用某个版本,不用再一个个去过滤了。