gpt4 book ai didi

react-native - 使react-native run-android命令在编译项目时不下载文件

转载 作者:行者123 更新时间:2023-12-05 03:06:32 27 4
gpt4 key购买 nike

我试图在 Linux 平台上为 android 编译一个 react-native 应用程序。

但是当我运行命令“react-native run-android”时,出现以下错误

Scanning folders for symlinks in /opt/react/App5/node_modules (8ms)JS server already running.Building and installing the app on the device (cd android && ./gradlew installDebug)...Downloading https://services.gradle.org/distributions/gradle-2.14.1-all.zipException in thread "main" java.net.ConnectException: Connection timed out (Connection timed out)    at java.net.PlainSocketImpl.socketConnect(Native Method)    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)    at java.net.Socket.connect(Socket.java:589)    at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:673)    at sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:173)    at sun.net.NetworkClient.doConnect(NetworkClient.java:180)    at sun.net.www.http.HttpClient.openServer(HttpClient.java:463)    at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)    at sun.net.www.protocol.https.HttpsClient.(HttpsClient.java:264)    at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367)    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191)    at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1156)    at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1050)    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1564)    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:263)    at org.gradle.wrapper.Download.downloadInternal(Download.java:58)    at org.gradle.wrapper.Download.download(Download.java:44)    at org.gradle.wrapper.Install$1.call(Install.java:59)    at org.gradle.wrapper.Install$1.call(Install.java:46)    at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65)    at org.gradle.wrapper.Install.createDist(Install.java:46)    at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:126)    at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)

我在不允许我下载文件的代理服务器后面 https://services.gradle.org/distributions/gradle-2.14.1-all.zip ,

我使用另一台计算机下载文件。是否可以设置“react-native run-android”命令不下载文件?

最佳答案

我找到了解决问题的方法:

我在“gradle/wrapper”文件夹中找到文件 gradle-wrapper.properties 并将 distributionUrl 的内容更改为

distributionUrl=file:/tmp/gradle-2.14.1-all.zip

现在可以使用了,不再需要下载文件了。

关于react-native - 使react-native run-android命令在编译项目时不下载文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49159432/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com