简体   繁体   English

与相同的库但版本不同发生冲突

[英]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.

相关问题 两个依赖项使用相同的库但具有不同的版本 - Two dependencies use the same library but with different versions 同一个库的两个不同版本是否可以共存? - Is it possible to have two different versions of a same library coexist? 同一个库的多个版本 - Multiple versions of same library 科尔多瓦Android库版本之间的冲突 - Cordova Android conflict between library versions 用于库和应用程序的不同gradle版本 - Different gradle versions for library and application 如何通过Gradle使Android Studio中的两个不同模块使用同一库的不同版本 - How to make two different modules in Android Studio use different versions of the same library via Gradle 如何有效地编写针对同一私有库的不同版本的具有不同构建风格的Android应用 - How to efficiently write an Android app with different build flavours targetting different versions of the same private library 相同的应用程序适用于不同的Android版本 - Same app for different android versions Android:结合同一个库的不同版本,一个是旧的,一个是在一个项目中迁移的 - Android: combining the same library's different versions where one is old and one is migrated in a project 不同Android版本上的相同设计 - Same Design on different Android versions
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM