gpt4 book ai didi

android - 运行 React Native 项目时出现连接被拒绝错误

转载 作者:行者123 更新时间:2023-11-29 02:23:16 25 4
gpt4 key购买 nike

我使用命令创建新的 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 Studio 中打开项目的 android 文件夹,并尝试将项目与下载的代理和相关依赖项同步。然后我运行此命令并成功构建项目。

react-native run-android

关于android - 运行 React Native 项目时出现连接被拒绝错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53834779/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com