【问题标题】:Connection Refused Error at Run ReactNative Project运行 React Native 项目时连接被拒绝错误
【发布时间】:2018-12-18 14:05:25
【问题描述】:

我使用命令创建新的 react-native 项目:

react-native init myProject

但是当我想用这个命令在模拟器或真实设备上运行它时:

react-native run-android

我收到此错误并且应用程序未构建:

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

在 build.gradle 我添加了 google() 但没有解决问题。 这是我的 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")
}

请大家帮忙。

【问题讨论】:

    标签: android react-native react-native-android expo


    【解决方案1】:

    终于找到答案了。 我在 Android Studio 中打开项目的 android 文件夹并尝试将项目与下载的代理和相关依赖项同步。然后我运行此命令并成功构建项目。

    react-native run-android
    

    【讨论】:

      【解决方案2】:

      我遇到了这个问题,我用代理解决了

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2019-07-06
        • 1970-01-01
        • 2017-08-18
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多