如何解决android studio中的gradle冲突? [英] How to resolve gradle conflicts in android studio?

查看:553
本文介绍了如何解决android studio中的gradle冲突?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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



正如你可以看到它显示红色的客栈,如果我把光标放在那里,我会得到'所有com.android.support库必须使用完全相同的版本规范。发现' $ b


'com.android.support:animated-vector-可绘制:27.1.0


'com.android.support:design:26.1.0'


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


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


',使用正确的版本,如图所示,即使显示错误。



请帮助。

$ b $当我们使用来自 Githu的外部库时,有时会发生这种情况b ,我已经面对过很多次了。我可以注意到你在项目中使用了一些外部库。这些库可能使用版本 27.1.0 ,并使用 26.1.0 。解决此问题的方法是删除这些库或将您的版本从 26.1.0更改为27.1.0



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

  allprojects {
存储库{
google()

//如果您使用的Gradle版本低于4.1,您必须使用:
// maven {
// url'https:/ /maven.google.com'
//}
//另一个网址是'https://dl.google.com/dl/android/maven2/'
}
}


Please find my gradle file below.

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:animated-vector-drawable:27.1.0

and

'com.android.support:design:26.1.0 '

So i followed the hint and explicitly added

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. 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. Solution to this problem is either remove those libraries or change your version from 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/'
    }
}

这篇关于如何解决android studio中的gradle冲突?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆