Perform the following steps to set up the Debug environment for Cordova debugging:
Click on the Debug icon in Visual Studio Code and then select the Configure gear icon in the toolbar.
Select the Cordova environment from the list.
The launch.json file for Visual Studio Code is set up for use with the available debug environment configurations. This file defines the debug configurations that are available to launch from Visual Studio Code. You can modify the default configurations or add new ones to the list, if required. For more information on available configuration options, visit
Perform the following steps to test your application using the supported simulators, emulators, and devices:
Select the configuration for debugging from the list available next to the Debug Start button.
Click on the Debug Start button to launch the debug session.
Simulating the app on a browser launches Chrome browser which displays your app. At the same time, the cordova-simulate window appears inside Visual Studio Code displaying the device specific attributes that can be modified to simulate a device.
Note: Debugging with the Chrome Simulator for iOS as well as Android can be performed on both Windows and Mac machines.
Perform the following steps to debug using an emulator:
For iOS
Ensure you are on a Mac machine.
Choose the Run iOS on Simulator debug option in Visual Studio Code.
Start debugging.
The iOS Simulator starts running and loads the hybrid App.
Note: To debug iOS hybrid apps on an emulator or device, you need a Mac OS X environment. To build the iOS app package that can be installed on an iOS emulator or device, you need the XCode Development environment running on a Mac.
For Android
Ensure you are on either a Mac or Windows machine.
Start the desired emulator from the Android Device Manager.
Choose Run Android on Emulator.
Start debugging.
The application loads in the running emulator.
Perform the following steps to debug on a device:
For iOS
Ensure you are on a Mac machine.
Connect your iOS device to the Mac using a USB cable.
Open the project in XCode.
In the navigation panel, click on the top-level folder for your project.
A series of tabs appear in the main panel.
Under General tab, for Signing section, provide values for Team Name, Provisioning Profile, and Signing Certificate options.
Under Build Settings tab, for Build Active Architecture Only, ensure that the Debug configuration is selected.
Open the project in Visual Studio Code.
Choose the Run iOS on Device debug option in Visual Studio Code.
Start debugging.
The hybrid app is built and deployed to the connected device. The app then starts on your device.
Notes:
Perform steps 3 to 6 only the first time you debug the application on a device. Subsequent times, you can make the code changes in Visual Studio Code and debug the project from Visual Studio Code itself.
To debug iOS hybrid apps on an emulator or device, you need a Mac OS X environment. To build the iOS app package that can be installed on an iOS emulator or device, you need the XCode Development environment running on a Mac.
For Android
Ensure you are on either a Mac or Windows machine.
Connect your device to the Mac or Windows using a USB cable.
Choose Run Android on Device.
Start debugging.
The hybrid app is built and deployed to the connected device. The app then starts running on your device.