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 connected via USB.

Created on 16 Jul 2020  路  46Comments  路  Source: facebook/react-native

On my Iphone, React Native Debugger does not work.

With emulator there is no problem. But when I use my Iphone, If I click reload button in Chrome React Native Debugger it is not working and it throws below error.

I can see logs on my Chrome React native debugger but it is not stable.

_Warn in Metro bundler console:_

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

Real device is connected. My all devices use same Wireless network.

React Native version:

System:
OS: macOS 10.15.5
CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
Memory: 110.77 MB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 12.13.1 - /usr/local/bin/node
Yarn: Not Found
npm: 6.14.6 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.9.0 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 13.6, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
Android SDK:
API Levels: 23, 28, 29
Build Tools: 28.0.3, 29.0.2, 29.0.3
System Images: android-28 | Google Play Intel x86 Atom, android-29 | Google APIs Intel x86 Atom, android-29 | Google Play Intel x86 Atom
Android NDK: Not Found
IDEs:
Android Studio: 3.5 AI-191.8026.42.35.6010548
Xcode: 11.6/11E708 - /usr/bin/xcodebuild
Languages:
Java: 1.8.0_232 - /usr/bin/javac
Python: 2.7.16 - /usr/bin/python
npmPackages:
@react-native-community/cli: Not Found
react: 16.11.0 => 16.11.0
react-native: 0.62.2 => 0.62.2

Steps To Reproduce

  1. Connect IOS device (IOS 13.6) to device.
  2. Validate real device connection on XCode
  3. Start app on real device
  4. Debugger and metro bundler starts
  5. Press reload button in debugger and get above error in metro bundler console
React Native Team Attention

Most helpful comment

Ok I solved this issue "No apps connected. " (on Android Emulator). Please follow this steps (only for Android) :

  • Open MainApplication.java and remove import com.facebook.react.BuildConfig;

  • Reset metro bundler cache : npx react-native start --reset-cache

  • Remove Android assets cache : cd android && ./gradlew clean

  • Relaunch metro server : npx react-native run-android

And see the magic 馃帀

If you have an error like Invariant Violation: Module AppRegistry is not a registered callabel module, scroll on your terminal to see the root cause.

All 46 comments

Same issue for me

Same issue for me too after migrate to RN 0.62 (from 0.59)
Using Windows and tested on Android

Morever, I don't know if it's linked byut metro doesn't bundle automatically my index.android.bundle. I have to use a manual cmd before to force bundling

So can you provide your full solution step by step please?

I don't have any solution about "No apps connected" problem, because I still have the same ...

I have just a solution about bundling (see this issue https://github.com/facebook/react-native/issues/18692), but I don't know if it is linked. Do you have the same problem ?

After 24 hours I solved this issue. Problem is somehow related to rn0.62 or its dependencies. I upgrade my project to 0.63.1 and it solved. 0.62 is really buggy version. I recommend 0.63.x

Okay, I will try this, thanks !

@hakkikonu Not working to me in Android. With command: react-native run-android, it is not attaching with npm. Please suggest any way out.

use 0.63.1

I'm having a similar issue and i think it is related to the Metro Bundler. Out of nowhere my React Native project stopped working. But even worse: No matter how fat I went back in my git history, This also affects new react native projects. When I create a new project with react-native init, after installing dependencies and pods, i cannot get the example app to run with react-native run-ios.

use 0.63.1

I am already using as you recommended. After too many deeps I found the problem which is My project got corrupted after package name changes.

Did you upgrade xcode recently? I started experiencing this problem since the day I installed Xcode 11.6. Im downloading 11.5 right now and will report if it solved my issue.

I also only have problems while deploying on actual devices. You can try to run the metro bundler from console while specifying a port
react-native start --port 8085 --reset-cache

Then try to see if you can access metro bundler from the browser: localhost:8085. Here you should see metro bundler info. In theory I guess, you should also be able to access this address from your phone or tablet. (Sometimes replacing "localhost" with your actual ip address helps). Here is also my problem, that this address isnt accessible through my devices, even while being on the same network.

Downgrading to 11.5 wont change a thing for me.

To anyone who also experinces this error: do you have also problems with freshly created projects using react-native init???

Yes, in my case I migrated an app from 0.48 to 0.52. So, I created a new project, and copy/paste codebase.
And yes, I have this problem since this new project.
I upgrade to 0.63 but still the same problem

I m using RN version 0.63.1, but still getting the same error.

For me I realized the issue was because my phone and laptop were not on the same network (one was on wifi one was on cellular). After putting phone on wifi it worked.

React Native is a real piece of work.

I have the same problem, but on Android.

And also, another:

I've created a react application with the command npx react-native init. it worked well. I can deploy this app on an Android Emulator, but cannot do it on my device. The device is in developer mode and when I run the command adb devices it returns the device connected.

But, when I try to run the npx react-native run-android command, it responds that No Android device or emulator connected.

Ok I solved this issue "No apps connected. " (on Android Emulator). Please follow this steps (only for Android) :

  • Open MainApplication.java and remove import com.facebook.react.BuildConfig;

  • Reset metro bundler cache : npx react-native start --reset-cache

  • Remove Android assets cache : cd android && ./gradlew clean

  • Relaunch metro server : npx react-native run-android

And see the magic 馃帀

If you have an error like Invariant Violation: Module AppRegistry is not a registered callabel module, scroll on your terminal to see the root cause.

I was able to resolve this on iOS when running on a real device. After bundle finishes, press the stop button in Xcode then open and close the app and it works fine.

image
(Only for iOS)
If the app build mode is a Release, it will not be connected.
To switch build you should go to the Xcode Product > Scheme > Edit Scheme and select Debug for Build Configuration.

The phone and the computer have to be on the same WiFi connection.

Sometimes connect pc and phone on the same network is not enough :/

i painstakingly updated from RN 0.59 to 0.62 and now i have this issue on iOS device. no shake, no metro-triggered dev menu or reload works.

i would try upgrading to 0.63 but react-native-webview doesn't fully support it.

I faced this issue with react-native 0.62.2. It got fixed after doing the following steps. Main issue got fixed after changing gradle distributionUrl from 6.2 to 6.3 , but these were things i did in the process if only gradle version doesn't fix it for you.

  • Check if node version >12 mine was less switched to 13.12. Removed node_modules and package-lock.json and run npm i .

  • run cd android && ./gradlew clean

  • update distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip in gradle-wrapper.properties.

  • run npx react-native run-android

I am having this issue with iOS. Using RN v0.63.2 and xcode v12.0 beta 5 with ios 14 beta on my device. I am unable to connect to the metro bundler and the app can only run on my device while it is running inside of xcode.

Windows 10.
With me the problem was solved as follows.
I was using PowerShell before and the error started to appear out of nowhere.
Then I opened the Command Prompt (CMD) in administrator mode. I ran the npx react-native run-android and then opened the normal emulator and stopped giving this error.

Sounds like some people were able to fix this by upgrading 0.63.x, others are reporting that didn't work, there's some workarounds suggested... but overall lots of people are hitting this and there's some confusion for sure. As people are able to unblock themselves definitely share so that others can benefit.

I also had the same problem in Android only - the development build didn't have Developer Menu or connection to the Metro Bundler.

The answer from @Johbrun helped me resolve it - just remove import com.facebook.react.BuildConfig;. I have added that line because I thought the BuildConfig class wasn't imported. However, that's not the case and importing it from the com.facebook.react namespace actually caused harm:

// com.facebook.react.BuildConfig;
public final class BuildConfig {
    public static final boolean DEBUG = false; // <---- debug is always false :(
    public static final String LIBRARY_PACKAGE_NAME = "com.facebook.react";
    /** @deprecated */
    @Deprecated
    public static final String APPLICATION_ID = "com.facebook.react";
    public static final String BUILD_TYPE = "release";  // <---- build type is always release
    public static final String FLAVOR = "";
    public static final int VERSION_CODE = 1;
    public static final String VERSION_NAME = "1.0";
    public static final int EXOPACKAGE_FLAGS = 0;
    public static final boolean IS_INTERNAL_BUILD = false;

    public BuildConfig() {
    }
}

The global BuildConfig which is the correct one:

public final class BuildConfig {
  public static final boolean DEBUG = Boolean.parseBoolean("true");
  public static final String APPLICATION_ID = "my_app_id";
  public static final String BUILD_TYPE = "debug";
  public static final String FLAVOR = "";
  public static final int VERSION_CODE = 22;
  public static final String VERSION_NAME = "2.2";
}

@tsvetan-ganev that seems like it should be included. Could you send a PR for that for someone to check out?

I had the same problem so I put the app in debug mode and saw this error
java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libreactnativejni.so
This answer helped https://stackoverflow.com/questions/54888255/react-native-app-crashes-on-real-android-device/54889555#54889555

I had this error when developing using react-native-macos. When I did npm run start:macos I got the error. Running npx react-native run-macos made it work again.

shaking device (or CMD + D ...) -> Configure Bundler -> metro bundler machine IP Address on Local Network

and also check this

iOS 14 > Settings > Privacy > Local Network

It works fine.

I had to run yarn web instead of yarn start

For me it was happening when using android emulator. Adding this to the android manifest did the trick:

<application
...
android:usesCleartextTraffic="true">
...
</application>

references:

For us, the issue was using a different configuration on ios. We created a Local configuration to connect to an emulated backend, this caused the live reload to stop working. It seems like it only works on Debug configuration.

Try this hakk谋 karde艧 put your terminal command at below.
adb reverse tcp:8081 tcp:8081
Then just start server
npx react-native start --reset-cache

It worked for me

Ok I solved this issue "No apps connected. " (on Android Emulator). Please follow this steps (only for Android) :

  • Open MainApplication.java and remove import com.facebook.react.BuildConfig;
  • Reset metro bundler cache : npx react-native start --reset-cache
  • Remove Android assets cache : cd android && ./gradlew clean
  • Relaunch metro server : npx react-native run-android

And see the magic 馃帀

If you have an error like Invariant Violation: Module AppRegistry is not a registered callabel module, scroll on your terminal to see the root cause.

I tried everything... I almost wanted to remove my code bit by bit to see which one is causing the issue. Luckily I didn't, it would've been a waste of time. Thank you so much!!!!!

In my case, it works well on ios simulator and android but not on real ios devices. What worked for me in ios was.

  • npx react-native start --reset-cache --port 8081 in terminal
  • Shake your ios device
  • Configure Bundler
  • Enter IP address from system preferences like the picture below
  • Add 8081 on the next field and empty on last

Screen Shot 2020-11-06 at 11 06 30 AM

Screen Shot 2020-11-06 at 10 56 52 AM

Ok I solved this issue "No apps connected. " (on Android Emulator). Please follow this steps (only for Android) :

  • Open MainApplication.java and remove import com.facebook.react.BuildConfig;
  • Reset metro bundler cache : npx react-native start --reset-cache
  • Remove Android assets cache : cd android && ./gradlew clean
  • Relaunch metro server : npx react-native run-android

And see the magic 馃帀

If you have an error like Invariant Violation: Module AppRegistry is not a registered callabel module, scroll on your terminal to see the root cause.

It Works for me

I think that metro should be smart enough to open the port redirection through adb as the default connection depends on that

Ok I solved this issue "No apps connected. " (on Android Emulator). Please follow this steps (only for Android) :

  • Open MainApplication.java and remove import com.facebook.react.BuildConfig;
  • Reset metro bundler cache : npx react-native start --reset-cache
  • Remove Android assets cache : cd android && ./gradlew clean
  • Relaunch metro server : npx react-native run-android

And see the magic 馃帀

If you have an error like Invariant Violation: Module AppRegistry is not a registered callabel module, scroll on your terminal to see the root cause.

Thanks you, i search Google in 3 days and you help me. Thanks you so much

El tel茅fono y la computadora deben estar en la misma conexi贸n WiFi.

I have had the same problem in iOS with React native 0.62 and the solution was it

Experienced this. My device was on a different network than machine running metro. Don't be me! Run on the same network!

Ok I solved this issue "No apps connected. " (on Android Emulator). Please follow this steps (only for Android) :

  • Open MainApplication.java and remove import com.facebook.react.BuildConfig;
  • Reset metro bundler cache : npx react-native start --reset-cache
  • Remove Android assets cache : cd android && ./gradlew clean
  • Relaunch metro server : npx react-native run-android

And see the magic 馃帀

If you have an error like Invariant Violation: Module AppRegistry is not a registered callabel module, scroll on your terminal to see the root cause.

It's worked!

Was this page helpful?
0 / 5 - 0 ratings