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