All com.android.support libraries must use the exact same version specification解决方法

在android studio的build.gradle中引入库有时会出现以下错误(supportLibraryVersion的值为28.0.0)

将鼠标放在报错行上会显示如下错误提示

All com.android.support libraries must use the exact same version specification
 (mixing versions can lead to runtime crashes). Found versions 28.0.0, 25.2.0. 
Examples include com.android.support:animated-vector-drawable:28.0.0 and 
com.android.support:support-media-compat:25.2.0

解决方法:

第一种:单一针对修改(使用module后面跟上句com.android.support:support-media-compat:25.2.0中两个冒号:之间的内容)

 //系统design
 api ("com.android.support:design:$rootProject.ext.supportLibraryVersion"){
     exclude module: 'support-media-compat'
 }

第二种:针对包含com.android.support的依赖库都除去(这种可以解决更多不同类型,有什么隐患暂时还不知道)

//系统design
api ("com.android.support:design:$rootProject.ext.supportLibraryVersion"){
   exclude group: 'com.android.support'
}

参考链接:

https://www.hellojava.com/a/68887.html

扫描二维码关注公众号,回复: 6482943 查看本文章

猜你喜欢

转载自blog.csdn.net/qq_31796651/article/details/91954367