Android项目报无法连接Connect to dl.google.com:443 [dl.google.com/114.250.65.33]

一、问题描述:

Android 第一次创建项目会出现这样的问题:

A problem occurred configuring root project 'My Application'.
> Could not resolve all artifacts for configuration ':classpath'.
   > Could not resolve com.android.tools.build:gradle:4.1.1.
     Required by:
         project :
      > Could not resolve com.android.tools.build:gradle:4.1.1.
         > Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/4.1.1/gradle-4.1.1.pom'.
            > Could not HEAD 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/4.1.1/gradle-4.1.1.pom'.
               > Connect to dl.google.com:443 [dl.google.com/114.250.65.33] failed: Connection refused (Connection refused)

二、解决方案:

2.1. 在project下的build.gradle修改为阿里云仓库地址

maven { url 'https://maven.aliyun.com/repository/google/'}
maven { url 'https://maven.aliyun.com/repository/jcenter/'}

 2.2. 截图如下:

猜你喜欢

转载自blog.csdn.net/hzqit520/article/details/126303696