All com.android.support libraries must use the exact same version secification(mixing versions..解决方案

在项目中引用第三方库的时候开发的时候经常出现All com.android.support libraries must use the exact same version specification

(mixing versions can lead to runtime crashes).Found versions 27.0.2,25.3.1.Examples include com.android.support:animated-vector-drawable:27.0.2and com.android.support:exifinterface:25.3.1.....的问题,如下图:

这是因为引用第三方库的时候第三方库中引入的依赖和你本地的依赖的版本不一致导致的,要是去修改的话比较麻烦可以在app下的build.gradle中写如下:

configurations.all {
    resolutionStrategy.eachDependency {
        DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == 'com.android.support') {
            if (!requested.name.startsWith("multidex")) {
                details.useVersion '27.0.2'//此处为你需要的版本
            }
        }
    }
}

clean一下项目重新编译一般就解决了。

发布了116 篇原创文章 · 获赞 165 · 访问量 17万+

猜你喜欢

转载自blog.csdn.net/qq_42618969/article/details/101443567