java Gradle:无法解析配置“:类路径”的所有依赖项

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/37716881/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-03 02:43:04  来源:igfitidea点击:

Gradle: Could not resolve all dependencies for configuration ':classpath'

javaandroidandroid-studiogradleandroid-gradle-plugin

提问by Taslim Oseni

I've been facing a problem with my android studio. Anytime I try to run an application, any application (even blank one), an error would occur. It's always in this form:

我的 android studio 遇到了问题。任何时候我尝试运行一个应用程序,任何应用程序(甚至是空白的),都会发生错误。它总是以这种形式:

NB: Flip is the name of the application...

注意:Flip 是应用程序的名称...

Error: Gradle: A problem occurred configuring root project 'Flip'. 
     - Could not resolve all dependencies for configuration ':classpath'. 
     - Could not resolve com.android.tools.build:gradle:1.1.0.
        Required by:
                   :Flip:unspecified

I've searched for solutions for days to no avail and it has rendered my android studio almost useless.

我已经搜索了几天的解决方案但无济于事,它使我的 android studio 几乎毫无用处。

采纳答案by Ahmad Aghazadeh

Update last version android studio to 2.1.2 and change

将最新版本的 android studio 更新到 2.1.2 并更改

classpath 'com.android.tools.build:gradle:2.1.2'

回答by Ahmad Aghazadeh

Go to your build.gradle (project), hover around the classpath and update the version to the suggested update.

转到您的 build.gradle(项目),将鼠标悬停在类路径周围并将版本更新为建议的更新。

If the suggestion above does not work, it means there is a sync problem. Simply do this:

如果上述建议不起作用,则表示存在同步问题。只需这样做:

File > Invalidate cache and restart

文件 > 使缓存无效并重新启动

If everything else is set up correctly, it's definitely bound to work after that.

如果其他一切都设置正确,那么它肯定会在那之后工作。