简体   繁体   中英

Unable to connect Android emulator to React Native debugger

I am unable to connect android emulator with react native debugger.

When I run react-native run-android , it brings up the app successfully without showing any errors. It also brings up node Metro Bundler as well. But it didn't print any logs in RN debugger. When I press Reload app on the page, it shows the following popup error:

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

I tried running this adb reverse tcp:8081 tcp:8081 but it doesn't work. When I press Cmd+m in my emulator, it is showing multi-touch. So I can't open developer menu as well.

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

How can I resolve this?

Emulator means real device or Android studio?

if you are trying to connect emulator from android studio please uninstall the device and install the Pixel 2 it may help you.

And Uninstall the React native debugger and install the latest one

The problem was that page was not loading properly after my RN version update from 0.59 to 0.6. I believe it has some other issues as well since I haven't tested in android from the very beginning. So, I just created a fresh project and imported all the files manually. Might not be the answer which you are looking for but that solved the problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM