简体   繁体   English

build.gradle:如何解决“无法解决依赖关系”错误?

[英]build.gradle: How to solve “Unable to resolve dependency for” error?

I am getting this gradle error when i build my app: 我在构建应用时遇到了gradle错误:

Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.squareup.okhttp3:okhttp:3.12.0. 无法解析':app @ debug / compileClasspath'的依赖关系:无法解析com.squareup.okhttp3:okhttp:3.12.0。

here in my app.gradle dependencies code here is the image screenshot of the app.gradle file 在我的app.gradle依赖项代码中, 这是app.gradle文件的图像截图

buildgradle file buildgradle文件

buildgradle file screenshot buildgradle文件截图

here are the gradle files codes 这是gradle文件代码

you need to add repository mavenCentral() into allprojects 's repositories . 您需要将存储库mavenCentral()添加到allprojectsrepositories

and please, don't post IDE screenshots, because it's painful to work with such input. 并且请不要发布IDE屏幕截图,因为使用这种输入很痛苦。

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

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