我正在尝试使用最新的 Nativescript 插件通过 Visual Studio Code 调试 Nativescript 演示应用程序,但失败了。另外,我使用 Genymotion 模拟器..
这是我的 launch.json:
{
"name": "Launch on Android",
"type": "nativescript",
"platform": "android",
"request": "launch",
"appRoot": "${workspaceRoot}",
"sourceMaps": true,
"diagnosticLogging": false,
"emulator": false,
"rebuild": true,
"tnsArgs": [
"--device 1"
]
},
这就是我得到的结果:
Cannot resolve the specified connected device by the provided index or identifier. To list currently connected devices and verify that the specified index or identifier exists, run 'tns device'.
从终端运行 tns 设备:
┌───┬─────────────┬──────────┬─────────────────────┬──────────┬───────────┐
│ # │ Device Name │ Platform │ Device Identifier │ Type │ Status │
│ 1 │ vbox86p │ Android │ 192.168.56.101:5555 │ Emulator │ Connected │
└───┴─────────────┴──────────┴─────────────────────┴──────────┴───────────┘
到目前为止,我尝试了以下方法:
- 重新安装 VSC Nativescript 插件
- 从 git repo 构建最新的 Nativescript 插件
- 通过 --geny 'Custom Phone' 启动
- 终止 ADB 服务器
但是,我可以通过终端正常运行或实时同步应用程序,但在 Visual Studio Code 中却不起作用。
最佳答案
我让它工作 -
On macOS systems, verify that you have added the following paths to the
PATH environment variable.
For Genymotion earlier than 2.6:
/Applications/Genymotion.app/Contents/MacOS/
/Applications/Genymotion Shell.app/Contents/MacOS/
For Genymotion 2.6:
/Applications/Genymotion.app/Contents/MacOS/player.app/Contents/MacOS
/Applications/Genymotion Shell.app/Contents/MacOS/
For example: Run the following command
export PATH=$PATH:/Applications/Genymotion\ Shell.app/Contents/MacOS/:/Applications/Genymotion.app/Contents/MacOS/
然后单击“在 Android 上启动”,确保您的 genymotion 设备已启动并运行。
有关更多信息,请查看此处 - https://www.nativescript.org/nativescript-for-visual-studio-code
关于android - 在 Visual Studio Code 上调试 Nativescript,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40009981/