Ionic 2 debugging on Android with Visual Studio Code

Posted Wednesday, November 2, 2016 3:35 PM by CoreyRoth

If you’re new to Ionic 2, you might have encountered some issues getting started debugging.  While you can usually debug fairly easily in the browser, when it comes to debugging on the device, there are some extra steps.

First, install the extension ionic2-vscode. This will give you the options in the debug menu to start the process. 

Ionic2VSCodeDebugMenu

However, before you start that, you need to make a change to package.json so that your breakpoints will be hit.  Change your “build” line to the following:

"build": "ionic-app-scripts build --dev",

The key there is to add the --dev parameter.  Now you can hit the debug button and wait.  It will take a while to startup but once it is running, the app should be on your device and your breakpoints will get hit.

If you have never deployed to your Android device before, you might try running “ionic run android” at the command line first to see if you have any other issues to resolve.

Comments

# re: Ionic 2 debugging on Android with Visual Studio Code

Monday, February 20, 2017 1:05 AM by Paolo

Hi and thanks. I'm new to Ionic, I followed all the steps and also checked on other sites, but I still cannot debug code in VS Code. I can launch iOS simulator and run the sample app but all my breakpoints are ignored.

Can you help me?

Thanks a lot

Leave a Comment

(required)
(required)
(optional)
(required)