Search code examples
debuggingvisual-studio-codereact-nativeremote-debugging

How to debug React Native Project (developed using Visual Studio Code) in Android Device


Can anyone help me with the steps of how to debug React Native application in Android mobile. https://github.com/microsoft/vscode-react-native has helped me to debug to an Emulator but it does not say anything on Android Devices. At one point they asked me to enable Debug JS Remotely but I couldn't find this feature in Android.


Solution

  • if your app is already running on a physical device follow steps from step 5

    step 1. Enable Debugging over USB

    step 2. Plug in your device via USB

    step 3. Check that your device is properly connecting to ADB

    List of devices attached
    emulator-5554 offline   # Google emulator
    14ed2fcc device         # Physical device
    

    Seeing device in the right column means the device is connected. You must have only one device connected at a time.

    step 4. Run your app

    react-native run-android
    

    If you get a "bridge configuration isn't available" error, see Using adb reverse.

    step 5. After the app is running on your device Physically shake your device to see options

    step 6. Keep Chrome open

    step 7. select Debug JS Remotely from the options

    Debugger will open on chrome