简体   繁体   English

如何解决android studio中的gradle冲突?

[英]How to resolve gradle conflicts in android studio?

Please find my gradle file below.请在下面找到我的 gradle 文件。 摇篮文件

As you can see its showing inn red.and if i place cursor there I get the hint as 'All com.android.support libraries must use the exact same version specification.Found '正如你所看到的,它显示的是红色的。如果我把光标放在那里,我会得到提示“所有 com.android.support 库必须使用完全相同的版本规范。找到”

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

and

'com.android.support:design:26.1.0 ' 'com.android.support:design:26.1.0'

So i followed the hint and explicitly added所以我按照提示并明确添加

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

' ,with the correct version ,as you can see in the image.Still its showing error. ' ,使用正确的版本,正如您在图像中看到的那样。仍然显示错误。

Please help.请帮忙。

This happened sometimes when we use external libraries from Github and I have faced it many times.当我们使用来自Github外部库时,有时会发生这种情况,我遇到过很多次。 I can notice you are using some external libraries in project.我可以注意到您在项目中使用了一些外部库。 These libraries might using version 27.1.0 and you are using 26.1.0 .这些库可能使用版本27.1.0而您使用的是26.1.0 Solution to this problem is either remove those libraries or change your version from 26.1.0 to 27.1.0此问题的解决方案是删除这些库或将您的版本从26.1.0 to 27.1.0更改26.1.0 to 27.1.0

and If you trying latest version, don't forgot to do following:如果您尝试最新版本,请不要忘记执行以下操作:

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/'
    }
}

支持库不应使用与 comileSdkVersion 不同的版本

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM