HarmonyOS | 鸿蒙 鸿蒙开发Gradle构建问题(代理设置错误)

2022-08-16 14:23:02 浏览数 (1)

今天刚开始学习鸿蒙开发,开发第一步构建项目就除了问题,报错如下:

代码语言:javascript复制
A problem occurred configuring root project 'MyFristHarmonyOSAPP'.
> Could not resolve all artifacts for configuration ':classpath'.
   > Could not resolve com.huawei.ohos:hap:3.0.3.4.
     Required by:
         project :
      > Could not resolve com.huawei.ohos:hap:3.0.3.4.
         > Could not get resource 'https://repo.huaweicloud.com/repository/maven/com/huawei/ohos/hap/3.0.3.4/hap-3.0.3.4.pom'.
            > Could not GET 'https://repo.huaweicloud.com/repository/maven/com/huawei/ohos/hap/3.0.3.4/hap-3.0.3.4.pom'.
               > Connect to 127.0.0.1:1080 [/127.0.0.1] failed: Connection refused: connect
      > Could not resolve com.huawei.ohos:hap:3.0.3.4.
         > Could not get resource 'https://developer.huawei.com/repo/com/huawei/ohos/hap/3.0.3.4/hap-3.0.3.4.pom'.
            > Could not GET 'https://developer.huawei.com/repo/com/huawei/ohos/hap/3.0.3.4/hap-3.0.3.4.pom'.
               > Connect to 127.0.0.1:1080 [/127.0.0.1] failed: Connection refused: connect
   > Could not resolve com.huawei.ohos:decctest:1.2.6.0.
     Required by:
         project :
      > Could not resolve com.huawei.ohos:decctest:1.2.6.0.

官方解决办法如下:

Windows:

代码语言:javascript复制
`gradle`代理设置错误,可以将`gradle`默认路径:`C:Users{你的电脑账号}.gradle`下配置的`gradle.properties`代理文件删除之后重新同步。

Mac:

代码语言:javascript复制
根目录下的gradle.properties中有关代理的设置都去掉,然后退出编译器,重新打开工程,重新同步。

删除gradle配置文件后退出开发工具,重新打开后刷新gradle,终于成功了

0 人点赞