androidreact-nativegradlemetro-bundler

React Native debug release build with Metro


I am working on a react-native application, when I run my debug build I am able to debug using the metro tool using the following commands.

npx react-native start 

npx react-native run-android

Magically my emulator pops up and if I click "d" in the metro terminal it activated my debugging tools.

When I run

npx react-native run-android --variant=release 

When I click "d" in the metro terminal it says

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

info Opening developer menu...

Is there something about the release build that does not allow for the use of these debugging tools or is there something I need to do within build.gradle or some other configuation file to enable using the metro debugger.

I am new to react-native development so my apologies if my terminology is off.

Appreciate you help!


Solution

  • After receiving feedback from various people on and off of SO it seems that the debugger is not meant to be used in the release build.

    In my circumstance there was an issue with gradle configuration involving react-native-config which was a known issue related to Progaurd which would only impact release builds.

    As recommended in this post I used the javascript alert() method to debug the issue.