如何解决 android 工作室中的 gradle 冲突?

How to resolve gradle conflicts in android studio?

请在下面找到我的 gradle 文件。

如您所见,它显示的客栈 red.and 如果我将光标放在那里,我会得到 'All com.android.support libraries must use the exact same version specification.Found '

的提示

'com.android.support:animated-vector-drawable:27.1.0

'com.android.support:design:26.1.0 '

所以我按照提示明确添加了

com.android.support:animated-vector-drawable:26.1.0

',使用正确的版本,如您在 image.Still 中看到的显示错误。

请帮忙。

Support library should not use a different version than the comileSdkVersion

当我们使用来自 Github 的外部库时,有时会发生这种情况,我遇到过很多次。我注意到您在项目中使用了一些外部库。这些库可能使用 27.1.0 版本,而您使用的是 26.1.0。此问题的解决方案是删除这些库或将您的版本从 26.1.0 to 27.1.0

更改为

如果您尝试最新版本,请不要忘记执行以下操作:

allprojects {
    repositories {
        google()

        // If you're using a version of Gradle lower than 4.1, you must instead use:
        // maven {
        //     url 'https://maven.google.com'
        // }
        // An alternative URL is 'https://dl.google.com/dl/android/maven2/'
    }
}