Xoyce
Xoyce

Reputation: 367

Debugging Nativescript on Visual Studio Code

I am trying, and failing, to debug Nativescript demo application via Visual Studio Code using latest Nativescript plugin. Also, I use Genymotion emulator ..

This is 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"
        ]
    },

and this is what I get for result:

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'.

Running tns device from terminal:

┌───┬─────────────┬──────────┬─────────────────────┬──────────┬───────────┐
│ # │ Device Name │ Platform │ Device Identifier   │ Type     │ Status    │
│ 1 │ vbox86p     │ Android  │ 192.168.56.101:5555 │ Emulator │ Connected │
└───┴─────────────┴──────────┴─────────────────────┴──────────┴───────────┘

So far I tried the following:

However, I can run or livesync application normally via terminal, but the same doesn't work in Visual Studio Code.

Upvotes: 2

Views: 2054

Answers (2)

Dlucidone
Dlucidone

Reputation: 1101

I get it working -

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/

then click on launch on android before that ensure your genymotion device is up and running.

For more info check here - https://www.nativescript.org/nativescript-for-visual-studio-code

Upvotes: 3

Xoyce
Xoyce

Reputation: 367

The solution wast to use default AVD emulator as @Nikolay Tsonev mentioned.

Upvotes: 0

Related Questions