我正在尝试使用最新的nativescript插件通过visual studio代码调试nativescript演示应用程序,但失败了。另外,我使用genymotion模拟器..
这是my 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“自定义电话”启动
正在终止ADB服务器
不过,我可以通过终端正常运行或livesync应用程序,但在visual studio代码中同样不起作用。

最佳答案

我让它工作-

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上的launch,确保genymotion设备已启动并运行。
更多信息请点击此处-https://www.nativescript.org/nativescript-for-visual-studio-code

关于android - 在Visual Studio Code上调试Nativescript,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/40009981/

10-12 06:18