Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom'

风格不统一 提交于 2019-12-10 23:54:12

问题


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:

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.

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.

  • Get more help at https://help.gradle.org

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:


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



来源:https://stackoverflow.com/questions/54722235/could-not-get-resource-https-dl-google-com-dl-android-maven2-com-android-tool

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!