com.android.support冲突的解决办法(第一行代码 第二版)

参考 https://blog.csdn.net/yuzhiqiang_1993/article/details/78214812

    当发生 All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes 错误时:

    当我们使用android studio添加一些第三方的依赖库时,很可能会提示上面这个错误。

    大致意思就是com.android.support的包版本号要保持一致,但是可能我们自己新建的项目的com.android.support包版本号要高一些,一些第三方的库的com.android.support可能没有及时更新support库,就会出现这个错误。

解决方法

    如果发生冲突了,依赖第三方库时候排除掉对com.android.support包的依赖,这样自己的项目随便依赖什么版本都可以。

    group:表示只要包含com.android.support的都排除

    如 com.github.bumptech.glide:glide:4.7.1 包含 com.android.support,当要使用 com.github.bumptech.glide:glide:4.7.1 库时,要排除其包含的 com.android.support(特定版本),防止与自己版本的 com.android.support 发生冲突,具体写法:

api("com.github.bumptech.glide:glide:4.7.1") {
    exclude group: 'com.android.support'
}


猜你喜欢

转载自blog.csdn.net/sinat_34933191/article/details/80388856
今日推荐