同一个库的多个版本 [英] Multiple versions of same library

查看:140
本文介绍了同一个库的多个版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个项目A,过去有模块A1,它使用了dagger v。1.2.2。
现在我想添加到依赖于匕首v.2.0的项目A,模块A2。
但我不能因为这两个匕首库存有冲突。我可以在不同的android模块中以某种方式获得多个版本的库吗?

 配置{
all * .exclude group:'com.google.android',模块:'support-v4'
}

依赖关系{
compile'c​​om .android.support:support-v4:13.0.0'
}

来自:< a href =https://github.com/stephanenicolas/robospice/issues/161 =nofollow> https://github.com/stepneneuros/robospice/issues/161



OR

 依赖关系{
compile( org.gradle.test.excludes:api:1.0){
exclude module:'shared'
}
}

发件人: https:// docs.gradle.org/current/userguide/dependency_management.html #52.4.7

I have project A, which used to have module A1, that used dagger v. 1.2.2. Now I'd like to add to project A, module A2, that has dependency on dagger v. 2.0. But I can't because these two dagger libs are in conflict. Can I approach somehow multiple versions of library in different android modules?

解决方案

You can't have both.

You need to exclude the conflicting libraries from dependencies:

configurations {
    all*.exclude group: 'com.google.android', module: 'support-v4'
}

dependencies {
    compile 'com.android.support:support-v4:13.0.0'
}

From: https://github.com/stephanenicolas/robospice/issues/161

OR

dependencies {
    compile("org.gradle.test.excludes:api:1.0") {
        exclude module: 'shared'
    }
}

From: https://docs.gradle.org/current/userguide/dependency_management.html #52.4.7

这篇关于同一个库的多个版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆