问题
build.gradle(Module:app) dependencies{}中引入:
implementation 'com.squareup.okhttp3:okhttp:4.2.2'
报错:
ERROR: Unable to resolve dependency for ':app@debug/compileClasspath': Could not download okhttp.jar
原因
项目中没有声明相应的仓库
修改前,build.gradle(Project:xxx)只申明了两个库:google()、jcenter()
解决方案
添加阿里云的库,此库加载速度比较快,而且包含的依赖包比较全,可以取代 jcenter()库;但google()库要保留,而且要放在首行
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }