【发布时间】:2019-10-25 08:15:53
【问题描述】:
我正在开发一个在 WebStorm 上使用 react-native 的移动应用程序,并尝试通过我使用 Android Studio 的 AVD Manager 创建的 Android 模拟器(Pixel API 28)对其进行测试。问题是当我运行react-native run-android 命令时,出现以下错误:
Could not determine the dependencies of task ':app:preDebugBuild'.
> Could not resolve all task dependencies for configuration
':app:debugRuntimeClasspath'.
> Could not resolve com.facebook.react:react-native:+.
Required by:
project :app
> Failed to list versions for com.facebook.react:react-native.
> Unable to load Maven meta-data from
https://jcenter.bintray.com/com/facebook/react/react-native/maven-metadata.xml.
> Could not HEAD
'https://jcenter.bintray.com/com/facebook/react/react-native/maven-metadata.xml'.
> Connect to jcenter.bintray.com:443 [jcenter.bintray.com/35.158.228.205, jcenter.bintray.com/3.120.47.203] failed: Read timed out
我尝试使用以下命令清理缓存,但没有成功:
npm cache clean --force
我在网络上找不到一些类似的问题,我不确定要显示与此问题相关的内容。
当我尝试运行我之前完美运行的一个项目时,在收到此错误后,我发现它也引发了相同的错误。同样,当我创建一个新的 react-native 项目并尝试运行它时,我也遇到了同样的错误。我该如何解决这个问题?
我仍在寻找解决方案。谁知道怎么解决?
【问题讨论】:
-
在 Android Studio 中打开您的应用并同步项目。 Android Studio 会自动为您下载并安装依赖项。
-
@ShamGir 这实际上不是一个 Android Studio 项目。我用 Android Studio 打开它,然后尝试创建一个运行/调试配置,但在模块选项卡上,它显示“
”。因此无法创建运行/调试配置。我在这里(stackoverflow.com/questions/19932793/…)阅读了有关如何在 Android Studio 中同步项目的信息,但我的工具菜单下没有 Android 选项卡。所以这对我不起作用。 -
文件选项卡中有一个同步选项。核实。 文件 -> 将项目文件与 gradle 文件同步
-
@ShamGir 问题又出现了。我尝试同步它,但没有成功。
标签: javascript react-native npm