[英]Conflict with same library but with different versions
I have my own project using the appcompat library: 我使用appcompat库拥有自己的项目:
implementation 'com.android.support:appcompat-v7:26.1.0'
And my project uses a library which use: 我的项目使用一个库,该库使用:
implementation 'com.android.support:appcompat-v7:26.0.1'
So Android Studio rises an error about this conflict. 因此,Android Studio会引发有关此冲突的错误。 But I have no choice in my project than using the latest version of compat, and keep the library using the old one.
但是在我的项目中,我别无选择,只能使用最新版本的compat,并使用旧版本的库。
How is it possible to merge both? 如何将两者合并? I already tried to exclude module like this:
我已经试图排除像这样的模块:
implementation('com.azquidk.sdk') {
exclude group: 'com.android.support', module: 'appcompat-v7'
exclude group: 'com.android.support', module: 'design'
}
But doesn't work. 但是不起作用。
EDIT 编辑
In the meantime I found this which works too: 同时,我发现这也可行:
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '26.1.0'
}
}
}
}
Try add this: 尝试添加以下内容:
android {
configurations.all {
resolutionStrategy.force 'com.android.support:appcompat-v7:26.1.0'
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.