在我的Android项目中我使用
compile 'com.squareup.okhttp:okhttp:2.2.0'
我需要 2.2.0 版的 okhttp 才能让我的代码正常工作。但是我添加的时候有问题
compile('io.intercom.android:intercom-sdk:1.1.2@aar') {
transitive = true
}
因为在 intercom-sdk 内部,对于更高版本再次存在 okhttp 依赖:
compile 'com.squareup.okhttp:okhttp:2.4.0'
我的代码使用更高版本 2.4.0 而不是我想要的 2.2.0 结果。请问有什么方法可以在我的模块中使用我指定的 2.2.0 并让对讲机使用它的 2.4.0?
最佳答案
你可以这样使用:
compile('io.intercom.android:intercom-sdk:1.1.2@aar') {
exclude group: 'com.squareup.okhttp', module: 'okhttp'
}
不过要注意。如果库使用 2.2.0 版本中不存在的方法,它将失败。
关于gradle - 不要在 Gradle 中使用来自传递依赖的更高版本的库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31402447/