Connection Refused Error at Run ReactNative Project

匿名 (未验证) 提交于 2019-12-03 01:39:01

问题:

I create new react-native project with command:

react-native init myProject 

But When I want run it on emulator or real device with this command:

react-native run-android 

I got this error and app not build:

FAILURE: Build failed with an exception.  * What went wrong: fresco/1.10.0/fresco-1.10.0.pom'.          > Could not GET 'https://jcenter.bintray.com/com/facebook/fresco/fresco /1.10.0/fresco-1.10.0.pom'.             > Connect to 127.0.0.1:9595 [/127.0.0.1] failed: Connection refused:  connect 

In build.gradle I added google() but did not solve problem. This is my build.gradle:

buildscript {     ext {         buildToolsVersion = "27.0.3"         minSdkVersion = 16         compileSdkVersion = 27         targetSdkVersion = 26         supportLibVersion = "27.1.1"     }     repositories {         maven { url "https://maven.google.com" }         jcenter()         google()         maven {             url 'https://maven.google.com/'             name 'Google'         }         mavenCentral()     }     dependencies {         classpath 'com.android.tools.build:gradle:3.1.2'          // NOTE: Do not place your application dependencies here; they belong         // in the individual module build.gradle files     } }  allprojects {     repositories {         mavenLocal()         maven { url "https://maven.google.com" }         google()         jcenter()         maven { url "https://jitpack.io" }         maven {             // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm             url "$rootDir/../node_modules/react-native/android"         }         maven {             url 'https://maven.google.com/'             name 'Google'         }     } } task wrapper(type: Wrapper) {     gradleVersion = '4.4'     distributionUrl = distributionUrl.replace("bin", "all") } 

Anybody help please.

回答1:

Finally I found answer. I open android folder of project in Android Studio and try to sync project with proxy and related dependency downloaded. Then I run this command and project build successfully.

react-native run-android 


回答2:

I had this problem, I solve it by using proxy



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