【问题标题】:Failed to download any source lists! (node.js v10.7.0 | yarn 1.7.0 | react-native: 0.56.0 | Windows 10)无法下载任何源列表! (node.js v10.7.0 | yarn 1.7.0 | react-native: 0.56.0 | Windows 10)
【发布时间】:2018-07-20 16:12:48
【问题描述】:

我正在尝试使用hear 阐明的步骤运行一个 hello world 应用程序。我很确定我已经完成了所有步骤。但是当我尝试react-native run-android 时,出现以下错误。

react-native run-android ouput

C:\Users\Mike-laptop\AwesomeProject>react-native run-android
Scanning folders for symlinks in C:\Users\Mike-laptop\AwesomeProject\node_modules (43ms)
JS server already running.
Building and installing the app on the device (cd android && gradlew.bat installDebug)...
NDK is missing a "platforms" directory.
If you are using NDK, verify the ndk.dir is set to a valid NDK directory.  It is currently set to C:\Users\Mike-laptop\AppData\Local\Android\Sdk\ndk-bundle.
If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.

Failed to download any source lists!
java.io.FileNotFoundException: https://dl.google.com/android/repository/repository2-1.xml

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> Failed to find Build Tools revision 26.0.3

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 4.602 secs
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

请注意,我在代理后面运行一切......这很可能是因为 react-native 没有使用我设置的代理。我试图以不同的方式配置东西方法。

  • 互联网选项
  • 纱线配置设置代理http://host:port
  • yarn config set h t t p s-proxy h t t p://host:port
  • npm config 设置代理 h t t p://host:port
  • npm config set h t t p s-proxy h t t p://host:port
  • 设置环境变量

    设置 h t t p s_proxy=h t t p s://127.0.0.1:8123 设置 h t t p _proxy=h t t p://127.0.0.1:8123 设置代理=h t t p://127.0.0.1:8123

仍然没有运气:(

非常感谢任何cmets。

【问题讨论】:

    标签: react-native npm yarnpkg


    【解决方案1】:

    首先,您需要配置您的 Android 环境以运行 Android 应用程序。

    请按照此链接中的步骤,在Building Projects with Native Code 选项卡中,选择Windows 和Android。:

    https://facebook.github.io/react-native/docs/getting-started.html

    确保在 Android Studio 中安装 Android SDK 构建工具 26.0.3。

    【讨论】:

    • 感谢您的回复...我安装了Build Tools revision 26.0.3,现在抱怨Failed to find Platform SDK with path: platforms;android-26
    • 我不明白为什么它需要 android-26 因为页面上说你需要我已经安装的 android-23。
    • Re: Failed to download any source lists! 我使用 SSH 隧道作为代理,然后我使用 polipo 将 socks 转换为 http 代理。然后我使用互联网选项并使用本地 IP 地址作为代理,但由于某种原因它无法正常工作。 (如果我使用 IE,它会抱怨它无法连接到代理服务器。)我也找不到任何解决方案。
    猜你喜欢
    • 2021-08-22
    • 1970-01-01
    • 2021-10-13
    • 1970-01-01
    • 2020-12-04
    • 1970-01-01
    • 2020-05-31
    • 2019-12-22
    • 1970-01-01
    相关资源
    最近更新 更多