Connect to jcenter.bintray.com:443 [jcenter.bintray.com/108.168.243.150] failed: 连接超时 (Connection...

在执行react-native run-android
出现错误

JS server already running.
Building and installing the app on the device (cd android && ./gradlew installDebug)...

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'testProject'.
> Could not resolve all dependencies for configuration ':classpath'.
   > Could not resolve com.android.tools.build:gradle:2.2.3.
     Required by:
         :testProject:unspecified
      > Could not resolve com.android.tools.build:gradle:2.2.3.
         > Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/2.2.3/gradle-2.2.3.pom'.
            > Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/2.2.3/gradle-2.2.3.pom'.
               > Connect to jcenter.bintray.com:443 [jcenter.bintray.com/108.168.243.150] failed: 连接超时 (Connection timed out)

这个问题让我头疼好久

公司网直接打开连接 是可以下载的

但是在命令行内直接下载是没有走代理
需要设置一下

打开项目/android/gradle.properties文件
在这一行下面android.useDeprecatedNdk=true
添加

systemProp.http.proxyPort=<你的端口号>
systemProp.http.proxyUser=<你的用户名>
systemProp.http.proxyPassword=<用户名登录密码>
systemProp.http.proxyHost=<代理地址>
systemProp.https.proxyPort=<你的端口号>
systemProp.https.proxyUser=<你的用户名>
systemProp.https.proxyPassword=<用户名登录密码>
systemProp.https.proxyHost=<代理地址>

ps:

systemProp.https.proxyUser=<你的用户名>
systemProp.https.proxyPassword=<用户名登录密码>

这两行可以根据需要添加 有些网不需要

你可能感兴趣的:(Connect to jcenter.bintray.com:443 [jcenter.bintray.com/108.168.243.150] failed: 连接超时 (Connection...)