前言
最近徒弟分到了一个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' }
重新编译即可解决问题
|