16

I searched but I can't find any external sources except for Visual Studio Code docs, and just following those docs doesn't allow me to debug React Native apps both in iOS and Android.

I keep getting the error message (this one for Android, for iOS, is similar:

[vscode-react-native] [Warning] Couldn't import script at http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false. Debugging won't work: Try reloading the JS from inside the app, or Reconnect the VS Code debugger: path must be a string

My launch.json file as:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Debug Android",
            "program": "${workspaceRoot}/.vscode/launchReactNative.js",
            "type": "reactnative",
            "request": "launch",
            "platform": "android",
            "internalDebuggerPort": 9090,
            "sourceMaps": true,
            "outDir": "${workspaceRoot}/.vscode/.react"
        },
        {
            "name": "Debug iOS",
            "program": "${workspaceRoot}/.vscode/launchReactNative.js",
            "type": "reactnative",
            "request": "launch",
            "platform": "ios",
            "target": "iPhone 6s",
            "internalDebuggerPort": 9090,
            "sourceMaps": true,
            "outDir": "${workspaceRoot}/.vscode/.react"
        },
        {
            "name": "Attach to packager",
            "program": "${workspaceRoot}/.vscode/launchReactNative.js",
            "type": "reactnative",
            "request": "attach",
            "internalDebuggerPort": 9090,
            "sourceMaps": true,
            "outDir": "${workspaceRoot}/.vscode/.react"
        },
        {
            "name": "Debug in Exponent",
            "program": "${workspaceRoot}/.vscode/launchReactNative.js",
            "type": "reactnative",
            "request": "launch",
            "platform": "exponent",
            "internalDebuggerPort": 9090,
            "sourceMaps": true,
            "outDir": "${workspaceRoot}/.vscode/.react"
        }
    ]
}

I'm trying to debug both in the iOS simulator and in an Android device but the process never attaches to the external JS debugger.

1

3 Answers 3

1

You can use Reactotron for debugging your React native apps for both iOS and Android. follow the official documentation for setup.

Sign up to request clarification or add additional context in comments.

1 Comment

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
0

Go to debug option in vscode and select debugging type

  • select attach to packager

  • run your react native app by

        react-native run-android

    -> shake the phone and select Debugg remote JS option

    Done...

Comments

-2

You can use Vscode extension "React native tools" for debugging react-native apps.

1 Comment

I think he is already using that extention

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.