我搜索了但除了Visual Studio Code文档之外我找不到任何外部来源,只是遵循这些文档不允许在iOS或Android中调试React Native应用程序。
我一直收到错误消息(这个用于Android,对于iOS类似:
[vscode-react-native] [警告]无法在http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false导入脚本。调试不起作用:尝试从应用程序内部重新加载JS,或重新连接VS Code调试器:path必须是一个字符串
我的launch.json
文件为:
{
"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"
}
]
}
我正在尝试在iOS模拟器或Android设备中进行调试,但该过程从不附加到外部JS调试器。
您可以使用Vscode扩展“React native tools”来调试react-native应用程序。
转到vscode中的debug选项并选择调试类型