All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes)

在升级SDK版本之后所有的安卓support库升级新版本后出现如下提示

All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes)

出现这个提示的原因是我们引用其它三方库用的support库和我们升级完的库版本不一致,所以我们需要让他们统一使用新版本,所以我们需要配置添加统一强制使用统一版本的配置。

首先在对应的gradle文件中添加support库版本定义,如下

def supportVersion = "27.1.1"

然后添加统一引用配置

configurations.all {
    resolutionStrategy {
        force "com.android.support:recyclerview-v7:supportVersion"
        force "com.android.support:appcompat-v7:supportVersion"
        force "com.android.support:support-v4:supportVersion"
        force "com.android.support:design:supportVersion"
        force "com.android.support:support-vector-drawable:$supportVersion"
    }
}

这个配置也是在根节点。如果在三方库中不存在冲突的不用在这里配置。

0 0 vote
Article Rating
Subscribe
提醒
guest
0 评论
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x