Could not resolve com.android.tools.build:gradle:7.0.2

在AndroidStudio中导入他人项目时报Could not resolve com.android.tools.build:gradle:7.0.2的错误

Could not resolve com.android.tools.build:gradle:7.0.2

 在网上找了很多的解决方法,都没有用,最后将Android模块下的bulid.gradle文件中的默认库注销掉替换成阿里云的镜像库

maven{ url ‘https://maven.aliyun.com/repository/google’ }
maven{ url ‘https://maven.aliyun.com/repository/jcenter’ }
maven{url ‘http://maven.aliyun.com/nexus/content/groups/public’}

Could not resolve com.android.tools.build:gradle:7.0.2

 

随后Tay Again,但是依旧报错,我们看到下面。

Could not resolve com.android.tools.build:gradle:7.0.2

 

Connect to 127.0.0.1:1080 [/127.0.0.1] failed: Connection refused: connect。网络代理出了问题,根据网上所说删除掉C:\用户\(你的电脑名)\.gradle中的gradle.propertise文件,或者删除掉里面的代理,再重新运行,把弹出的Proxy settings 对话框×掉,依旧没有作用,最后我将gradle.propertise中最后几句改为

systemProp.http.proxyHost=
systemProp.https.proxyHost=
systemProp.https.proxyPort=1080
systemProp.http.proxyPort=1080

Could not resolve com.android.tools.build:gradle:7.0.2

 

再Sync Now后没有问题了Could not resolve com.android.tools.build:gradle:7.0.2

 

上一篇:android stuido Could not install Gradle distribution from ‘https://services.gradle.org/distributions


下一篇:A ResourcePool could not acquire a resource from its primary factory or source.