react-native - 本地运行 react native 应用失败
问题描述
使用react-native init FirstApp
我创建了一个示例项目,当我尝试使用我运行应用程序react-native run-android
时出现以下错误:
FAILURE:构建失败并出现异常。
A problem occurred configuring root project 'MyFirstApp'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not download builder.jar (com.android.tools.build:builder:3.4.1)
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/builder/3.4.1/builder-3.4.1.jar'.
> Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/builder/3.4.1/builder-3.4.1.jar'.
> Connect to dl.google.com:443 [dl.google.com/172.217.212.91, dl.google.com/172.217.212.190, dl.google.com/172.217.212.93, dl.google.com/172.217.212.136] failed: Connection timed out: connect
> Could not download manifest-merger.jar (com.android.tools.build:manifest-merger:26.4.1)
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/manifest-merger/26.4.1/manifest-merger-26.4.1.jar'.
> Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/manifest-merger/26.4.1/manifest-merger-26.4.1.jar'.
> Connect to dl.google.com:443 [dl.google.com/74.125.124.190, dl.google.com/74.125.124.93, dl.google.com/74.125.124.136, dl.google.com/74.125.124.91] failed: Connection timed out: connect```
Can somebody help me out here?
解决方案
我通过设置代理配置得到了解决方案。gradle.properties
在文件中设置以下配置
# HTTP proxy configuration
systemProp.http.proxyHost=your.proxy.host
systemProp.http.proxyPort=8080
systemProp.http.proxyUser=username
systemProp.http.proxyPassword=password
# HTTPS proxy configuration
systemProp.https.proxyHost=your.proxy.host
systemProp.https.proxyPort=8080
systemProp.https.proxyUser=username
systemProp.https.proxyPassword=password
推荐阅读
- python-3.x - Matplotlib- 在多色线子图下方添加一个颜色条,如图所示
- javascript - 如何在 Promise.all 中使用第一个 promise 的结果,以此类推
- python - 如何在python中的等高线图上绘制梯度向量
- docker - 在 Dockerfile 中链接 docker 容器
- c# - net core web api项目的类库中的依赖注入
- c# - C# 我的迷宫生成器似乎无法处理具有三个开放面的块
- php - symfony5 - 错误 500 页面而不是在树枝中形成错误
- python - 使用 Python 将每一列绘制为一行并按 Dataframe 每一列的第一行分组
- java - Java 扫描仪跳线
- wpf - WPF,ListBox逐项滚动到基于像素的滚动