Android studio编译中Connect to maven.google.com:443[xxx] failed: connect timed out的解决方法

前言

最近徒弟分到了一个rn的模块开发工作,但rn,大家懂的,Android studio有时需要科学上网下载必要的rn库。又是一个徒弟哀嚎的日子。

问题

连接maven.google.com超时

具体编译报错如下:

> Could not resolve all artifacts for configuration ':react-native-qr-decode-image-camera:releaseRuntimeClasspath'.
   > Could not resolve com.facebook.react:react-native:+.
     Required by:
         project :react-native-qr-decode-image-camera
      > Failed to list versions for com.facebook.react:react-native.
         > Unable to load Maven meta-data from https://maven.google.com/com/facebook/react/react-native/maven-metadata.xml.
            > Could not get resource 'https://maven.google.com/com/facebook/react/react-native/maven-metadata.xml'.
               > Could not GET 'https://maven.google.com/com/facebook/react/react-native/maven-metadata.xml'.
                  > Connect to maven.google.com:443 [maven.google.com/142.251.43.14] failed: connect timed out

解决方法

方法一:

科学上网【具体科学上网不做科普】,该方法解决最为简单

方法二:

修改maven下载的地址,使用aliyun上的镜像

具体修改方法如下:

将报错部分的build.gradle文件中

google()

或者有些开源库写成这样的

        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }

替换成

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

重新编译即可解决问题

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值