android - 无法将 Android 模拟器连接到 React Native 调试器

标签 android react-native android-emulator react-native-android

我无法将 android 模拟器与 react native 调试器连接起来。

当我运行 react-native run-android ,它会成功启动应用程序而不会显示任何错误。它还带来了节点 Metro Bundler。但它没有在 RN 调试器中打印任何日志。当我在页面上按 Reload app 时,它显示以下弹出错误:

React Native: No apps connected
Sending 'reload' to all React Native apps failed. Make sure your app is running in the simulator or on a phone



Popup error when press on RN debugger "Reload app" button

我试过运行这个 adb reverse tcp:8081 tcp:8081但它不起作用。当我在模拟器中按 Cmd+m 时,它显示多点触控。所以我也无法打开开发者菜单。

unintentional triggered when pressed Cmd+m
System:
    OS: macOS Mojave 10.14.6
    CPU: (4) x64 Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz
    Memory: 60.96 MB / 8.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 12.12.0 - /usr/local/bin/node
    npm: 6.12.0 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
    Android SDK:
      API Levels: 27, 28, 29
      Build Tools: 28.0.3, 29.0.2
      System Images: android-27 | Google APIs Intel x86 Atom, android-28 | Google APIs Intel x86 Atom, android-29 | Google APIs Intel x86 Atom
  IDEs:
    Android Studio: 3.5 AI-191.8026.42.35.6010548
    Xcode: 11.3/11C29 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.9.0 => 16.9.0 
    react-native: ^0.61.5 => 0.61.5 
  npmGlobalPackages:
    react-native-cli: 2.0.1

我该如何解决这个问题?

最佳答案

模拟器是指真机还是安卓工作室?

如果您尝试从 android studio 连接模拟器,请卸载设备并安装 Pixel 2,它可能会对您有所帮助。

并卸载 React native 调试器并安装最新的

关于android - 无法将 Android 模拟器连接到 React Native 调试器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59437544/

相关文章:

android - 在没有模拟器的情况下测试 Android 浏览器?

android - 打包自运行android模拟器

Android Studio 不显示按钮的属性

android - 跳过了 60 帧!应用程序可能在其主线程上做了太多工作

android - 如何在 AndEngine 中创建 ScrollView

c# - Visual Studio 2017 中的 Android 设备管理器显示 'Android SDK Platform is Missing'

Android GCM 项目 ID,哪个?

react-native - React Native : Can't use this. setState() 在 2D 数组内设置变量,但 this.state.x= 有效

javascript - react Native JWT-auth Error fetching api

java - react native - 错误 : method does not override or implement a method from a supertype