简体   繁体   English

Maven:com.android.support:support-annotations:28.0.0的依赖项收敛错误

[英]Maven: Dependency convergence error for com.android.support:support-annotations:28.0.0

We get this error when trying to include following dependency in our project: 尝试在我们的项目中包括以下依赖项时,会出现此错误:

<dependency>
      <groupId>com.android.support</groupId>
      <artifactId>support-fragment</artifactId>
      <version>28.0.0</version>
      <type>aar</type>
    </dependency>

we have pasted complete trace here . 我们已经在此处粘贴了完整的跟踪。 as far as we can see it is saying that the same assembly depends on two different versions. 据我们所知,同一程序集取决于两个不同的版本。 how can that be possible? 那怎么可能呢?

and
+-com.google.zxing:android:4.7.10
  +-com.android.support:support-fragment:28.0.0
    +-com.android.support:support-compat:28.0.0
      +-com.android.support:collections:28.0.0
        +-com.android.support:support-annotations:28.0.0
and
+-com.google.zxing:android:4.7.10
  +-com.android.support:support-fragment:28.0.0
    +-com.android.support:support-compat:28.0.0
      +-android.arch.lifecycle:runtime:1.1.1
        +-android.arch.lifecycle:common:1.1.1
          +-com.android.support:support-annotations:26.1.0

How can we fix this error? 我们如何解决该错误?

Try to put this code at the bottom of your Gradle file where there is the list of dependencies 尝试将此代码放在您的Gradle文件的底部,其中有依赖项列表

configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == 'com.android.support' && !requested.name.contains('multidex')) {
            details.useVersion '28.0.0'
        }
    }
}

You can always override the old version of the library by adding the library to your dependencies. 您始终可以通过将库添加到依赖项来覆盖库的旧版本。 For your problem, try overriding by adding the support-annotations dependency like this: 对于您的问题,请尝试通过添加support-annotations依赖项来覆盖,例如:

<dependency>
      <groupId>com.android.support</groupId>
      <artifactId>support-annotations</artifactId>
      <version>28.0.0</version>
      <type>aar</type>
</dependency>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 与依赖项&#39;com.android.support:support-annotations&#39;冲突 - Conflict with dependency 'com.android.support:support-annotations' 警告:与依赖项“com.android.support:support-annotations”冲突 - Warning:Conflict with dependency 'com.android.support:support-annotations' 与项目中的依赖项“ com.android.support:support-annotations”冲突 - Conflict with dependency 'com.android.support:support-annotations' in project 找不到com.android.support:support-annotations:26.1.0 - Could not find com.android.support:support-annotations:26.1.0 无法解析 com.android.support:support-annotations 26.0.1 - Failed to resolve com.android.support:support-annotations 26.0.1 警告:与依赖项&#39;com.android.support:support-annotations&#39;(25.0.1)冲突 - Warning:Conflict with dependency 'com.android.support:support-annotations' (25.0.1) 错误:无法解决:com.android.support:support-annotations:26.0.2 - Error:Failed to resolve: com.android.support:support-annotations:26.0.2 与依赖&#39;com.android.support:support-annotations&#39;冲突。 app(23.3.0)和测试app(23.1.1)的已解决版本有所不同 - Conflict with dependency 'com.android.support:support-annotations'. Resolved versions for app (23.3.0) and test app (23.1.1) differ 与依赖'com.android.support:support-annotations'冲突。 app(23.1.0)和测试app(23.0.1)的已解决版本有所不同 - Conflict with dependency 'com.android.support:support-annotations'. Resolved versions for app (23.1.0) and test app (23.0.1) differ 与项目':app'中的依赖'com.android.support:support-annotations'冲突。 app(26.1.0)和测试app(27.1.1)的已解决版本有所不同。 - Conflict with dependency 'com.android.support:support-annotations' in project ':app'. Resolved versions for app (26.1.0) and test app (27.1.1) differ.
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM