Could not get resource 'https://dl.google.com/

2019-07-09 23:29发布

I recently started to use react native, but according to Iranians Sanctions, gradle cannot build my first projects, so I used VPN and also shecan service but I get the following error:

my error

I read React native instructions and followed them, set up an emulator, react native cli, and chocolaty service. In environments, it was written that I should define my platform-tools folder of my SDK in a variable named PATH. But in variables, I have already had path in username and in system variables. In edit, I have added my platform-tools to them. But unfortunately it didn't work yet.

my enviroments

The PowerShell error messages in the image are:

PS C:\Others\RN_projects\React_native_shop\shop_project> react-native run-android

Starting JS server...

Building and installing the app on the device (cd android && gradlew.bat installDebug)... FAILURE: Build failed with an exception.

  • What went wrong: A problem occurred configuring root project 'shop_project'. Could not resolve all artifacts for configuration ':classpath'. Could not resolve com.android.tools.build:gradle:3.2.1.

Required by:

project : Could not resolve com.android.tools.build:gradle:3.2.1. Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom'. Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom'. Connect to 127.0.0.1:8580 [/127.0.0.1] failed: Connection refused: connect

Could not resolve com.android.tools.build:gradle:3.2.1.

Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom'. Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom'.

Connect to 127.0.0.1:8580 [/127.0.0.1] failed: Connection refused: connect

  • Try:

Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

BUILD FAILED in 3s Could not install the app on the device, read the error above for details. Make sure you have an Android emulator running or a device connected and have set up your Android development environment: https://facebook.github.io/react-native/docs/getting-started.html

events.js:173

throw er; // Unhandled 'error' event ^ Error: spawn cmd.exe ENOENT

at Process.ChildProcess._handle.onexit (internal/child_process.js:246:19) at onErrorNT (internal/child_process.js:421:16) at processTicksAndRejections (internal/process/next_tick.js:76:17)

Emitted 'error' event at: at Process.ChildProcess._handle.onexit (internal/child_process.js:252:12) at onErrorNT (internal/child_process.js:421:16) at processTicksAndRejections (internal/process/next_tick.js:76:17)

1条回答
狗以群分
2楼-- · 2019-07-10 00:15

Add this proxy information to your gradle.properties file:

systemProp.https.proxyPort=9595
systemProp.http.proxyHost=127.0.0.1
systemProp.https.proxyHost=127.0.0.1
systemProp.http.proxyPort=9595

and set above proxy port (ex. 9595) in your vpn like psiphone. Then sync project.

see this post

查看更多
登录 后发表回答