Giter Club home page Giter Club logo

vscode-cordova's Introduction

Cordova Tools Extension

Build Status

Visual Studio Marketplace Version Visual Studio Marketplace Rating (Stars)

Debug your code, find commands in the Command Palette, and use IntelliSense to browse objects, functions, and parameters in plugin APIs. This extension works with any Cordova-based project.

Choose Cordova debugger

Install it

  1. Install NodeJS

  2. Open a Terminal (on a Mac) or a Command Prompt (on a Windows computer).

  3. Run npm install -g cordova

  4. If you're planning on targeting iOS devices,

  5. If you're planning on targeting Android devices, set up your machine by following instructions at Android Platform Guide from Apache Cordova

Add a platform to your Cordova project

Open a Terminal or a Command Prompt and run the following command in the root directory of your project

cordova platform add android

Supported platforms: android, ios

Choose the Cordova debug environment

Click the debug icon (Choose Cordova debugger) in the View bar, and then click the configure gear icon (Configure-gear) to choose the Cordova debug environment.

Choose Cordova debugger

The launch configuration file appears. It contains some default configurations such as what is shown below.

Cordova launch configuration file

You can modify these configurations or add new ones to the list. Just don't add a Windows configuration as it is not supported yet.

You can use other fields in these configurations as well. Here's the complete list:

Name Description Defaults
port The port number that the debugger uses to connect to a device or emulator.
Type: number
9222
platform The target platform to run for (either ios, android, browser or serve; other platforms are not currently supported).
Type: string
n/a
target Target to run on. Possible values: emulator, device, <name or id of your target emulator or device>,. For simulation in the browser, you can use chrome, edge. If the value is emulator the quick pick window will be expanded with the names of the available Android virtual devices (for iOS virtual targets the list of available system versions of the target will be shown first, and after that another quick pick window will be expanded with the list of iOS simulators names with the selected version of the system), then the target value in launch.json will be changed to the AVD name/iOS Simulator udid of the selected virtual device. If you have only one virtual device available, it will be selected automatically.
Note: If you're using Android emulator targets, please, make sure the emulator utility is added to PATH.
Type: string
emulator
trace Trace may be set to true to print diagnostic logs of the extension to the console and write diagnostic logs of the Javascript debugger to the disk.
Type: boolean
true
sourceMaps Set this field to true if you want the debugger to use javascript sourcemaps (if they exist).
Type: boolean
false
sourceMapPathOverrides A set of mappings for rewriting the locations of source files from what the sourcemap says, to their locations on disk.
Type: object
{
"webpack:///./*": "${cwd}/*",
"webpack:///src/*": "${cwd}/*",
"webpack:///*": "*",
"webpack:///./~/*": "${cwd}/node_modules/*",
"./*": "${cwd}/*"
}
webkitRangeMin, webkitRangeMax Combines to specify the port range that you want the debugger to use to find the specific device or simulator described in the configuration.
Type: number
9223, 9322
attachAttempts The maximum number of times that you want the debugger to attempt to attach to a running iOS app.
Type: number
5
attachDelay The time in milliseconds between each attempt to attach to a running iOS application.
Type: number
1000
attachTimeout Time in milliseconds to wait before the debugger is attached to the debug session.
Type: number
10000
iosDebugProxyPort The port number that you want the debugger to use when it launches iOS applications on a device.
Type: number
9221
ionicLiveReload Set to true to enable Ionic live reload.
Type: boolean
false
devServerAddress For Ionic live reload scenario specify the IP address the device can use to contact the Ionic server.
Type: string
n/a
devServerPort For Ionic live reload scenario specify the port the device can use to contact the Ionic server.
Type: number
n/a
devServerTimeout Timeout in milliseconds for starting the Ionic dev server when serving to the browser or running with Ionic live reload enabled.
Type: number
20000
simulatePort Port to use for connecting to the local Cordova Simulate server.
Type: number
8000
livereload When simulating in the browser, determines whether live reload is enabled.
Type: boolean
true
forcePrepare When simulating in the browser, determines whether a file change triggers a cordova prepare before live reloading.
Type: boolean
false
corsProxy When simulating in the browser, determines whether XHR requests are proxied to appear as though they originate from the same domain as the target.
Type: boolean
true
livereloadDelay When simulating in the browser, set the delay in milliseconds between saving of a modified file and the application page reloading.
Type: number
200
simulateTempDir The directory where temporary browser simulation files are hosted.
Type: string
${workspaceRoot}/.vscode/simulation
runArguments Run arguments (array) to be passed to cordova run/build <platform> or ionic serve command (Override all other configuration params).
Type: array
n/a
cordovaExecutable The path to the local Cordova/Ionic executable. For example:
  • macOS - ./node_modules/.bin/cordova
  • Windows - .\\node_modules\\.bin\\cordova.cmd
Type: string
n/a
env Environment variables passed to the program.
Type: object
n/a
envFile Absolute path to a file containing environment variable definitions.
Type: string
${workspaceFolder}/.env
skipFiles An array of file or folder names, or path globs, to skip when debugging.
Type: array
[ ]
pathMapping A mapping of URLs/paths to local folders, to resolve scripts in app webroot to scripts on disk.
Type: object
{
"/": "${workspaceFolder}"
}
runtimeVersion If nvm (or nvm-windows) or nvs is used for managing Node.js versions, this attribute can be used to select a specific version of Node.js.
Type: string
n/a

Debug your Cordova-based project

To start the debugger, choose a target from the target drop-down list, and then either click the start button (Configure-gear) or press F5.

Cordova launch targets

To restart a Cordova application debugging correctly click on the Restart Cordova debugging button. In case of a launch debug scenario the application will be rebuild otherwise the debugger will reattach to the application.

Restart Cordova debugging button

You can debug your app on an Android emulator or an Android/iOS device. If you have your app running in one already, you can attach the debugger to it. The debugger uses the application ID of your project to locate the running instance.

Visual Studio Emulator for Android: To deploy your app to the Visual Studio Emulator for Android using our extension, you first need to manually launch the emulator. Once it is running, select the Debug Android on Device debug target rather than the emulator target. If ADB didn't automatically recognize the VS Android emulator when you launched it, you will need to run adb connect [EMULATOR'S IP] on the command prompt before trying to deploy. To find out the IP address of your emulator, click the double arrow icon at the bottom of the emulator's side-menu to open the "Additional Tools" window, and go to the "Network" tab. Use the IP of an appropriate network adapter in the list.

We won't go into all of the great things that you can do with the Visual Studio Code debugger, but you can read about it here.

Troubleshooting tip: If you receive an error stating that ADB is not recognized as an internal or external command, you'll have to update your path variable to include the location of your ADB executable file. The ADB executable file is located in a subfolder along with your other Android SDK files. For example, on a Windows computer, the location of the ADB executable file would likely be here: C:\Program Files (x86)\Android\android-sdk\platform-tools.

Troubleshooting tip: If you press debug button, but nothing happens and you can see only pending spinner for a long time, make sure that Cordova project is opened as a workspace root. If, for instance, you have one parent directory, and your Cordova project is in a subdirectory, it is recommended to use a multi-root workspace approach, so that the debugger can find the necessary Cordova files properly.

Find Cordova commands in the Command Palette

In the Command Palette, type Cordova and choose a command.

Cordova commands

The Build command triggers cordova build and builds for all platforms that you've added to the project.

Since all platforms are built you may receive errors for incompatible configurations. For example, if you're on a Windows computer, and you've added an iOS platform to your project, you'll get an error because you need a Mac to build for iOS platforms. You can't build an iOS app on a Mac by using VSCode on a Windows computer.

The Prepare command triggers cordova prepare, which transforms config.xml metadata to platform-specific manifest files, copies icons & splashscreens, copies plugin files for specified platforms so that the project is ready to build with each native SDK.

The Run command triggers cordova run and starts your app without debugging and just like the Build command, it runs all platforms that you've added to your project.

The Simulate Android in browser and Simulate iOS in browser launch your application in the browser and they are described in the next section.

Simulate your app in the browser

The debugging target list includes two additional targets: Simulate Android in browser and Simulate iOS in browser. If you don't see these targets in your debugging target list, you might have to remove your .vscode/launch.json configuration file and regenerate it by following the steps described in the Choose the Cordova debug environment section.

If you just want to run the application in the browser without debugging, two commands with the same names are available in the Command Palette.

If you launch the application using one of these debug targets or commands, the application will launch in Chrome, and Visual Studio Code will display an additional panel that controls the simulation for the core plugins added to your project. Here are some of the new features:

  • support for the majority of core plugins
  • live reload
  • event firing
  • device screen resizing (while debugging only)

Cordova Simulate

Note: If the simulate panel is closed accidentally when you navigate to a new file in your editor, it can be reopened by using Ctrl+Tab. This is the same command you use for navigating through your open documents.

Here is a video demo of the feature. If you have feature requests or suggestions, please reach out to us here.

Support for Ionic

  • The debug target includes the ability to serve to the browser for use with Ionic projects. You can now deploy and debug directly to Chrome, live reload is enabled by default.

  • We've included a number of useful JavaScript and HTML code snippets for your project, try typing ion_ in the editor to see what's available.

JavaScript snippets HTML snippets

  • New Ionic commands have also been added to the Command Palette, type Ionic in the palette to see the full list.

  • Ionic live reload is supported on devices and emulators.

  • Additional IntelliSense has been added for Ionic, Angular and JQuery.

Use IntelliSense with Plugin APIs

Intellisense helps you discover objects, functions, and parameters in libraries that your project consumes. Now you can use it for the more popularly used core plugins.

IntelliSense

IntelliSense appears only for plugins that you've added to your project, but it doesn't matter whether you add the plugin before or after you install this extension.

Just start typing in the code editor to see the objects, functions, and parameters of your plugin's API.

By default, this extension supports the typings for the following plugins. To add typings for other plugins, place the appropriate .d.ts file(s) in your project's .vscode/typings folder.

  • cordova-plugin-battery-status
  • cordova-plugin-camera
  • cordova-plugin-contacts
  • cordova-plugin-device
  • cordova-plugin-device-motion
  • cordova-plugin-device-orientation
  • cordova-plugin-dialogs
  • cordova-plugin-file
  • cordova-plugin-file-transfer
  • cordova-plugin-globalization
  • cordova-plugin-inappbrowser
  • cordova-plugin-media
  • cordova-plugin-media-capture
  • cordova-plugin-network-information
  • cordova-plugin-splashscreen
  • cordova-plugin-statusbar
  • cordova-plugin-vibration
  • cordova-plugin-websql
  • cordova-plugin-x-toast
  • ionic-plugin-keyboard
  • phonegap-plugin-barcodescanner
  • phonegap-plugin-push

Use IntelliSense with injected Ionic and Angular services

While IntelliSense is also available for Ionic and Angular, these frameworks use a dependency injection model for built-in services that VSCode's language service cannot understand by default.

To properly enable IntelliSense in these scenarios, you will need to use JSDoc headers.

IntelliSense for Angular and Ionic services

Our extension will provide the typings for you, so all you have to do is create the JSDoc headers above the functions you wish to receive IntelliSense for.

Note: JSDoc headers may not be supported (for IntelliSense purposes) in old VSCode versions.

For Ionic services, the service type will be in the following format: ionic.[service].Ionic[Service]Service, where [service] and [Service] should be replaced with the service's name, without the $ionic prefix. For example:

@param {ionic.popup.IonicPopupService} $ionicPopup - The $ionicPopup service

@param {ionic.modal.IonicModalService} $ionicModal - The $ionicModal service

For Angular services, the service type will be in the following format: angular.I[Service]Service, where [Service] should be replaced with the capitalized service's name, without the $ prefix. For example:

@param {angular.ITimeoutService} $timeout - The Angular $timeout service

@param {angular.IHttpService} $http - The Angular $http service

For a list of supported services for IntelliSense, see the angular.d.ts and ionic.d.ts typing files, which our extension places by default under .vscode/typings in your project.

How to disable telemetry reporting

VS Code Cordova extension collects usage data and sends it to Microsoft to help improve our products and services. Read our privacy statement to learn more.

If you don’t wish to send usage data to Microsoft, please follow the instructions below to disable its collection.

Windows

  • Edit VSCodeTelemetrySettings.json file at %appdata%\vscode-cordova and add "optIn":false.

OS X / Linux

  • Edit VSCodeTelemetrySettings.json file at ~/.vscode-cordova and add "optIn":false.

Known Issues

Error Debugger can't detect any webview

We used ios-webkit-debug-proxy for the iOS debugging. For the tool limitation, the iOS debugging is not working on some new iOS version both on real device and simulator(as known 14.4+). The debugger should work well if ios-webkit-debug-proxy fix this issue and release new version. You can find more reference in some open issues here.

Error 'Cannot connect to runtime process, timeout after {0} ms - (reason: {1}).', '{_timeout}', '{_error}' occured while running debug scenarios

Try to increase attach timeout by adding attachTimeout configuration parameter.

Error Error running android while running Ionic 4 project for android platform

It caused by ionic cli bug. As workaround, you can use Node JS v10+.

After running Ionic 4 project on native platform I get white screen in application and error (intermediate value).fill is not a function in Debug Console.

Explanation and solution for it.

I try to attach to Ionic 4 app running with livereload but breakpoints are not being hit or being placed to incorrect positions

Add "ionicLiveReload": true to your attach debug configuration and reattach.

A complete list of known issues can be found on GitHub

vscode-cordova's People

Contributors

alsorokin avatar auchenberg avatar benjaminbi avatar dependabot[bot] avatar dlebu avatar etatanova avatar ezioli01 avatar guillaumejenkins avatar hamiltonia avatar itoys avatar jicongw avatar jiglionero avatar jmatthiesen avatar joshuaskelton avatar lexie011 avatar matrosov-nikita avatar meenakb avatar mslaguana avatar nicolashenry avatar nisheetjain avatar patniko avatar patobeltran avatar redmickey avatar rido-min avatar ridomin avatar roblourens avatar ruslan-bikkinin avatar sergey-akhalkov avatar sound120 avatar svekl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vscode-cordova's Issues

Is it possible to use remotebuild with VS Code?

I'm currently using VS2015 Community Edition on Windows, targetting iOS using remotebuild on a remote mac server. Is it possible to achieve this same setup with VS Code? I haven't found any documentation making reference to such setup.

Using Ionic commands in a fresh Ionic project tries to add the iOS platform

Newly created Ionic projects come with the iOS platform added in their config.xml. This means that on the first build command you run, the iOS platform will be added to your project. This is generally unwanted on Windows (since the iOS build will fail), and maybe even on Mac (see #66).

To fix this, simply run ionic platform remove ios in your project.

iOS device live reload instabilities: device freezes, app doesn't deploy, app is unresponsive

When doing multiple iOS device live reload sessions in a row, you may start experiencing instabilities on the device itself. This can manifest in the form of the device becoming completely unresponsive, the app not launching, etc.

The underlying issue is that the Ionic live reload server does not always terminate the lldb process correctly when shutting down.

Workarounds:

  • Update to the latest Cordova and Ionic, and make sure you have the latest cordova-ios platform in your project (remove iOS and re-add it if need be). We have noticed this issue seems to happen less frequently with Ionic 1.7.14+, Cordova 6.0.0+ and cordova-ios 4.1.0+.
  • Run killall lldbafter an iOS live reload session to properly kill the process. Be very careful with the killallcommand!
  • Unplug the device and plug it back

We should prevent extension activation if the user opens a sub-folder of his project

Right now, our extension allows users to open sub-folders of their Cordova / Ionic projects. This can cause weird issues related to where we place certain files. For example, we will place typings at the project root, which is outside the open workspace.

We should instead prevent activation and warn the user that we only support projects that are open at their root.

Adb port forwarding persists after android debugging session ends.

If you debug for android and then try to debug for iOS without using a different port setting in launch.json, you'll hit an issue where the iOS code path attempts to attach to the android port and gets confused. For now we recommend that you use different ports or close the android emulator, but in future we should stop the adb port forwarding when the debug session terminates.

We install typings even if the user has a typings/ folder

Our extension only looks at .vscode/typings/ to determine whether we should install the typings for the user. If the user already has a typings/ folder with his typings inside, we will install the typings again, and this leads to tsc complaining about duplicate definitions, etc.

Typings could technically be anywhere in the project, so it's hard to protect against every possible scenario, but we can at least look specifically for a typings/ folder and look for existing typings there before installing any new ones to .vscode/typings/.

Ripple integration

Are you planning ripple or Microsoft Android emulator support?
At the moment are very different the experiences with Cordova Tools for Visual Studio and Cordova Tools for VS Code :/

vscode module not found

Hi,
I had followed the guidelines and during "gulp build", the error is raised:

[12:25:45] Using gulpfile ~.vscode\extensions\vscode-cordova\gulpfile.js
[12:25:45] Starting 'build'...
src\cordova.ts(6,25): error TS2307: Cannot find module 'vscode'.
src\utils\cordovaCommandHelper.ts(7,22): error TS2307: Cannot find module 'vscode'.
test\cordova.test.ts(10,25): error TS2307: Cannot find module 'vscode'.
[12:25:48] TypeScript: 3 semantic errors
[12:25:48] TypeScript: emit succeeded (with errors)
[12:25:48] Finished 'build' after 2.73 s

I have installed the npm module 'vscode' but I still have the #error.

Regards
Rénald

Build Error : Unreachable code detected.

Building the extension results in the following error :

debugger\common\v8Protocol.ts(215,5): error TS7027: Unreachable code detected.

Looks like there the default condition has a throw & break

default:
    throw new Error('Unknown state');
    break;

Removing the break fixes that issue (PR Pending #94), but results in a different error #93

[cordova-debug-adapter] Error: Unable to find web view

On my Mac, I am able to execute cordova build or cordova runwithout problems. But when it comes to debugging, I always get the error

[cordova-debug-adapter] Error: Unable to find web view

In the debug console, the last output is

Configuring debugging proxy

According to the documentation of ios_webkit_debug_proxy, I should see the connected devices on http://localhost:9221. But this page can be displayed only, when I start ios_webkit_debug_proxy manually in the terminal:

$ios_webkit_debug_proxy
Listing devices on :9221
Connected :9222 to SIMULATOR (SIMULATOR)

But when I try debugging, I still get the same error.

The configuration in my launch.json is

{
  "name": "Attach to running iOS on simulator",
  "type": "cordova",
  "request": "attach",
  "platform": "ios",
  "target": "emulator",
  "port": 9220,
  "sourceMaps": true,
  "cwd": "${workspaceRoot}"
}

I was wondering, that here the port is 9220, but the proxy tells something with 9222. Therefore I changed the port in launch.json, too. But this produces only another error:

[cordova-debug-adapter] Error: Unable to find iOS target device/simulator. Try specifying a different "port" parameter in launch.son

I am using the following versions:

  • Cordova Tools: 1.0.4
  • ideviceinstaller: 1.1.0_2
  • iso-webkit-debug-proxy: 1.6

Getting unknown platform error when trying to debug cordova project on windows though running Project from command Palette is working fine.

From @v-pavanp on April 1, 2016 23:52

  • VSCode Version: 0.10.12-alpha
  • OS Version:Windows10

Steps to Reproduce:
_Create setup for Cordova project._
- a. Run npm command from command prompt to install cordova. (npm install cordova –g)
- b. Create cordova project using yeoman “ yo cordova” and select Windows option.
- c. Verify cordova version by running command: cordova –v
- d. Install platform package using command : “cordova platform add windows –g” and cordova
platform add WP8 –g”
- e. Verify install and available platforms “cordova platforms ls”
- f. Build project using command : cordova build windows.
- g. Run emulator using “cordova emulate windows”
***Launch VS code

  1. Open project root directory.
  2. Click on the debug icon (Choose Cordova debugger) in the View bar, and then click the configure gear icon (Configure-gear) to choose the Cordova debug environment.
  3. Update launch.json and remove all the config entries except one.
  4. Update platform value to wp8 or windows or anycpu.
  5. Now press F1 and enter : cordova: Build and then cordova: Run.
  6. Verify app behavior and output.
  7. Now Try to debug app by selecting configuration name provided in the launch.json and verify output.

Actual: Getting platform error.
image
Error Message in output window:
waiting for v8 protocol on stdin/stdout
workbench.main.js:90 [cordova-debug-adapter] Error: Unknown Platform: wp8: Error: [cordova-debug-adapter] Error: Unknown Platform: wp8
at Object.w [as create](file:///C:/Program Files %28x86%29/Microsoft VS Code Alpha/resources/app/out/vs/workbench/workbench.main.js:30:24005)
at file:///C:/Program Files (x86)/Microsoft VS Code Alpha/resources/app/out/vs/workbench/workbench.main.js:100:13355
at Object.p [as _notify](file:///C:/Program Files %28x86%29/Microsoft VS Code Alpha/resources/app/out/vs/workbench/workbench.main.js:23:21660)
at Object.n.undefined.F.enter (file:///C:/Program Files (x86)/Microsoft VS Code Alpha/resources/app/out/vs/workbench/workbench.main.js:23:24988)
at n.undefined.t.Class.define._run (file:///C:/Program Files (x86)/Microsoft VS Code Alpha/resources/app/out/vs/workbench/workbench.main.js:23:26309)
at n.undefined.t.Class.define._chainedError (file:///C:/Program Files (x86)/Microsoft VS Code Alpha/resources/app/out/vs/workbench/workbench.main.js:23:25668)
at n (file:///C:/Program Files (x86)/Microsoft VS Code Alpha/resources/app/out/vs/workbench/workbench.main.js:23:23496)
at Object.p [as _notify](file:///C:/Program Files %28x86%29/Microsoft VS Code Alpha/resources/app/out/vs/workbench/workbench.main.js:23:21660)
at Object.n.undefined.F.enter (file:///C:/Program Files (x86)/Microsoft VS Code Alpha/resources/app/out/vs/workbench/workbench.main.js:23:24988)
at n.undefined.t.Class.define._run (file:///C:/Program Files (x86)/Microsoft VS Code Alpha/resources/app/out/vs/workbench/workbench.main.js:23:26309)

Expected:

  1. User should be able to debug app.
  2. User should get the intellisense when updating Platform value or tooltip should display proper message with all the available and supported platforms.
    image

image

Copied from original issue: microsoft/vscode#4874

Breakpoints become "unverified" (grayed out) during live reload

If your app is currently running in a live reload session, and you modify a script that is loaded on the device, the breakpoints in that script will become unverified (grayed out).

Please note that debugging and breakpoints should continue to work as expected, so the workaround is to simply ignore the issue.

When running on iOS simulator, changing "target" causes the extension to wait forever when trying to attach

If you change the "target" property in the Run iOS on Simulator to something valid like "iPhone-5", you won't be able to attach to the app. It will wait forever at the Attaching to app. step. It won't even timeout or anything. Note that the app will still be deployed correctly and will be running on the simulator. When live reload is enabled, the app correctly live reloads.

Note that this only happens when the simulator wasn't already running. If it's already running (even if for a different target), and then you change the target and F5 again, the correct simulator is launched with the new target, and the extension attaches just fine. So, a workaround for this is to leave the default property, "target": "emulator", run once, and then change the target to the desired value without quitting the simulator.

Live reload ignores the "merges" folder

ionic serve and ionic run --livereload ignore the "merges" folder. If you have platform-specific code in that folder, it won't be run when live reloading.

not using typescript sourcemaps when landing on debug breakpoints using cordova extension launch/attach configuration

I'm trying to use vscode cordova extension debug/launch settings on a simple cordova typescript ng2 application, based on https://angular.io/docs/ts/latest/quickstart.html, where the launch/attach settings rely on the vscode marketplace chrome [ http://aka.ms/vscDbgCh ] and cordova tools [ http://aka.ms/vscDbgCt ] extensions.

I can get vscode to successfully launch/attach to the ripple [ or android ] emulator session but when it stops on my typescript soft breakpoints its doing so using the transpiler app/.js output and not the app/.js.map output that aligns with my original sources.

This can be repro’d by cloning https://github.com/myusrn/acu6withng2 | opening in vscode | setting a few break points in app/main.ts and/or app.component.ts | then from command line in app1 folder executing "npm install" + "npm run tsc" + "ripple emulate" from app1 folder | then selecting vscode debug | launch | "Launch ripple emulate browser with sourcemaps" option.

Instead of using "ripple emulate" and "launch ripple emulate browser with sourcemaps" option I moved to using "cordova emulate android" and "attach to running android on emulator" which exercises vscode marketplace cordova extension, vs chrome one, and with that i'm getting "Error [cordova-debug-adapter] TypeError: Path must be a string. Received undefined" result.

[cordova-debug-adapter] - Error: Unable to find iOS target device/simulator

Hey there,

iOS 8.1.2, el capitan.

Tried out the tools after a clean install of cordova tools. The simulator works flawless, but I am running into some issues on debugging on a device. (iOS)

The "Run iOS on device" threw an error on "Configuring debugging proxy" step:
"[cordova-debug-adapter] Error: Unable to find iOS target device/simulator. Try specifying a different "port" parameter in launch.json"

The port is set to 9220 in the launch.json. I was able to get rid of the error message by restarting visual studio code and changing the port to 9221. However, I am still not able to hit a breakpoint or type anything into the debug console. (i.e. console.log('test'); -> "TypeError: Cannot read property 'runting_evaluate' of undefined).
Visual Studio Code seems to be stuck of some sort. Or at least the loading bar in the top left corner indicates a busy state.

https://github.com/google/ios-webkit-debug-proxy; I find only references to 9221 - 9322.

Am I missing something, or is this a bug?

Update: Able to reproduce on device using iOS 9.2.1 as well.

Can't debug ionic 2 typescript project

Got the following error message when I was trying to Run iOS on simulator:

Launching for ios (This may take a while)...
Launching app (This may take a while)...
Attaching to ios
Configuring debugging proxy
Unable to communicate with ios_webkit_debug_proxy
connect ECONNREFUSED 127.0.0.1:9220

I didn't change anything in launch.json:

    {
        "name": "Run iOS on simulator",
        "type": "cordova",
        "request": "launch",
        "platform": "ios",
        "target": "emulator",
        "port": 9220,
        "sourceMaps": true,
        "cwd": "${workspaceRoot}",
        "ionicLiveReload": false
    },

ionic info:

Your system information:

Cordova CLI: 6.0.0
Gulp version: CLI version 3.9.0
Gulp local: Local version 3.9.1
Ionic Version: 2.0.0-beta.3
Ionic CLI Version: 2.0.0-beta.23
Ionic App Lib Version: 2.0.0-beta.13
ios-deploy version: 1.8.2
ios-sim version: 5.0.6
OS: Mac OS X El Capitan
Node Version: v5.3.0
Xcode version: Xcode 7.3 Build version 7D175

What could be the reason? Thanks.

Fail to Debug/Attach to an Ionic Project Created from a Template

Repro Steps

  1. Create an Ionic project from a template. e.g. ionic start myApp tabs
  2. Open in VS Code
  3. Run on iOS simulator.

Root Cause

It appears that Ionic templates package the platform directory along with the www directory. As a result the iOS app name is HelloCordova.app and not the app name we expect so we filter it out.

Workaround

  1. Remove the ios platform
  2. Add the ios platform

jsconfig.json is not created at the project root

We recently added logic to create a jsconfig.json file for the user to enable IntelliSense. However, we create that file at workspace root, not at the Cordova / Ionic project root. This means that if the user opens a subfolder of his project (like www), we create the jsconfig.json at the wrong place.

Error while remote debugging device - ECONNRESET

Hello,
I use Code and the cordova extensions. I created an app using Ionic CLI and created a proj in Code. I succesfully debugged the app using "serve to the browser" (also after adding "runtimeExecutable" to the config.json).

I tried to use "Run Android on device" and I receive the following error notifications:

Cannot connect to the target: read ECONNRESET
error: listener not found
error: listener not found

My device is a veteran Galaxy S II running JellyBean NeatROM. USB Debugging is enabled and I can see the device in Chrome://devices and in adb.

Am I missing something here?

[cordova-debug-adapter] TypeError: Cannot read property 'nodeValue' of undefined

In between, I am able to debug my app in the simulator (#54). But now I wanted to debug on an attached iPhone. When I select Run iOS on device, I see in the debug console:

Launching for ios (This may take a while)...
Launching app (This may take a while)...
Installing app on device
Launching app

And the I get the error

[cordova-debug-adapter] TypeError: Cannot read property 'nodeValue' of undefined

When I select Attach to running iOS on device, I see in the debug console:

Attaching to ios
Configuring debugging proxy

And then I get the same error as above.

Breakpoints are not hit when debugging in iOS simulator

Hi. When launching the app from Visual Studio Code, using the Run iOS simulator option, the breakpoints are not hit. I'm using the Cordova Hello World app and ios-webkit-debug-proxy is installed and running in http://localhost:9220/.
More data:

  • I´ve tested using the Android emulator and breakpoints work.
  • I´ve also tested using Web Inspector from Safari into the simulator and the debugging works there.

Output from the http://localhost:9223/ URL as listed in http://localhost:9220/:

Inspectable pages for SIMULATOR:

    * file:///Users/sdurandeu/Library/Developer/CoreSimulator/Devices/10790EE6-1B12-42D3-A7B8-6C2BD536C06B/data/Containers/Bundle/Application/978974A6-1777-41F7-A994-C503AF1D1BC8/HelloCordova.app/www/index.html

I'm using OSX El Capitan and iOS 9.1 device. Any ideas?

Build Error : Type Not assignable

Building the extension results in the following error :

debugger\webkit\webKitDebugAdapter.ts(348,16): error TS2322: Type 'Promise<Promise[]>' is not assignable to type 'Promise<SetBreakpointByUrlResponse[]>'.

Stack Trace :

[08:16:10] Starting 'build'...
debugger\webkit\webKitDebugAdapter.ts(348,16): error TS2322: Type 'Promise<Promise[]>' is not assignable to type 'Promise<SetBreakpointByUrlResponse[]>'.
Type 'Promise[]' is not assignable to type 'SetBreakpointByUrlResponse[]'.
Type 'Promise' is not assignable to type 'SetBreakpointByUrlResponse'.
Property 'result' is missing in type 'Promise'.
debugger\webkit\webKitDebugAdapter.ts(512,35): error TS2339: Property 'error' does not exist on type 'Promise'.
debugger\webkit\webKitDebugAdapter.ts(513,34): error TS2339: Property 'result' does not exist on type 'Promise'.
src\utils\telemetryHelper.ts(86,13): error TS7027: Unreachable code detected.
[08:16:16] TypeScript: 4 semantic errors
[08:16:16] TypeScript: emit succeeded (with errors)
[08:16:17] Finished 'build' after 6.93 s

Don't work iOS simulator / iPhone 6 plus device

When i try run on iOS device with this configuration
ios_webkit_debug_proxy
Listing devices on :9221
Connected :9222 to iPhone 6 Plus (f58f8fc314e00cff009fc430ed82270a79058308)

{
 "name": "Run iOS on simulator",
 "type": "cordova",
 "request": "launch",
 "platform": "iOS",
 "target": "emulator",
 "port": 9222,
 "sourceMaps": true,
 "cwd": "${workspaceRoot}",
 "ionicLiveReload": false
}

receive this error

- CreatingStagingDirectory (5%)
 - ExtractingPackage (15%)
 - InspectingPackage (20%)
 - TakingInstallLock (20%)
 - PreflightingApplication (30%)
 - InstallingEmbeddedProfile (30%)
 - VerifyingApplication (40%)
 - Error occurred: ApplicationVerificationFailed
Error running 'ideviceinstaller -id \ ....\BuzzPack.ipa

If launch on iOS simulator open app but show an error alert :

[cordova-debug-adapter] Error: Unable to find web view

Debug fails with [cordova-debug-adapter] Error: Unable to find device

Attempting to do Run Android on device results in this message in console:

Launching for android (This may take a while)...
App successfully launched
Attaching to android
Unable to find device

However the 'HelloCordova' app is successfully running on my device! (and was launched by the above action)

I'm using VSCode on Fedora Linux 23. I have Android Studio installed on the same system and it works with my device just fine.

[Issue] [Cordova Tool] Unable to debug with error: "Path must be string. Received null" after upgrade VS Code from 0.10.9 to 0.1010

I am getting the error [cordova-debug-adapter] TypeError: Path must be string. Received null when trying to debug my phonegap app using "Cordova tools".
Steps:

Installed VSCode Version 0.10.9 (0.10.9)
installed cordova extension from extensions gallery
selected Cordova from debug configuration and used default launch.json
clicked 'Run Android on emulator' Got the error as above.

I tried to add the workaround as mentioned in microsoft/vscode#3625
I tried to set sourceMaps as false and "outDir": "${workspaceRoot}" , but still getting same error.

I don't know which sourcemaps I have to specify as mentioned in the workaround. I am using Mac 10.10.5

Screenshot as below:
screen shot 2016-03-06 at 5 46 28 pm

VS Android Emulator not supported

Steps to reproduce:

  • create Cordova project
  • add Android platform
  • launch VS Emulator for Android
  • launch "Run Android on emulator" task

The extension waits forever, no log is shown, no error is displayed.

Adding the emulator name to the "target" setting in launch.json does launch it, but the debugger does not attach. After launching the application, an error is displayed (Debug adapter cannot find emulator ...).

Recent iOS versions do not report source maps

It looks like newer iOS versions do not report a property that we expect when dealing with sourcemaps: We require that when a script is parsed by the webview, it sends an event with a body.sourceMapsURL property that points to the location of the source map. If it does not include this, we do not work with source maps.

It looks like iOS 8.1 reports this property, but 9.3 does not, and I have yet to see where exactly the change happened.

The practical upshot is on newer iOS targets, you can only debug the final javascript, not any previous source.

Breakpoints not working with Ionic 2

I Run Android on Emulator:

Launching for android (This may take a while)...
App successfully launched
Attaching to android
Forwarding debug port
Attaching to app.
DEPRECATION WARNING: 'enqueueTask' is no longer supported and will be removed in next major release. Use addTask/addRepeatingTask/addMicroTask
DEPRECATION WARNING: 'dequeueTask' is no longer supported and will be removed in next major release. Use removeTask/removeRepeatingTask/removeMicroTask
Angular 2 is running in the development mode. Call enableProdMode() to enable the production mode.
DEVICE READY FIRED AFTER 751 ms

It works but the app doesn't stop at breakpoint (Unverified Breakpoint).

screen shot 2016-04-06 at 3 16 04 pm

What could be the reason? Thanks.

Does this work with ReactNative?

ReactNative uses JSC on both iOS and Android, and I believe the JSC for iOS would work with ios-webkit-debug-proxy.

  1. Does this work?
  2. Have you supported showing profiling information from JSC?

If it doesn't yet work, I think it would be a great addition to this toolchain.

Problem with cordova plugin in VS CODE

I run VS CODE and I am trying to install extention in our intranet environment (proxy). I have got error:
getaddrinfo ENOTFOUND proxy.coig.com:3128 proxy.coig.com:3128:3128 without success.
What can I do?

How to disable cordova plugin

I can use cordova with Visual Studio Plugin . But When I create nodejs project not cordova , I build (cmd+shit +b in my mac ), it can not compile well . just like this
2016-02-04 11 54 15 How can I disable the plugin when it is not cordova project ?

Editor Action Format Hotkey not working after using Build Hotkey

Visual Studio Code on Mac, Shift + Alt + F for auto-format (editor.action.format) does not work after Shift + Command + B has been pressed to Cordova build the project.

To reproduce the error, open up the project, then:

  1. Shift + Command + B
  2. Click into a file (in my case JS), do a formatting change i.e. add spacing
  3. Shift + Alt + F
  4. No Change. (Unexpected)

Some further notes:

  • I do exclude platforms folder using the settings.json
  • Using Shift + Command + P and clicking Cordova Build will not trigger this bug
  • Toggling output did not change behaviour
  • Shift + Alt + F will work as expected after restart of visual studio code

[Issue] [Cordova Tool] Unable to "Attach to running iOS on device" , "Run iOS on simulator", & "Run iOS on device" after updated the VS Code from version 0.10.9 to version 0.10.10

Symptom
When the Visual Studio Code has been installed with Cordova Tools plugin and has been upgraded from version 0.10.9 to version 0.10.10, running or debugging cordova /ionic app through options "Attach to running iOS on device", "Run iOS on simulator" & "Run iOS on device" returns [cordova-debug-adapter] TypeError: Path must be a string. Received undefined error

Replication Steps

  1. Ensure that the Visual Studio code's version is earlier than version 0.10.10 and has been installed with cordova tools extension.
  2. Open an Ionic project's folder then run it through option "Run iOS on simulator" or "Run iOS on device" . Confirm that no error happened and the iOS app runs successfully.
  3. Update the Visual Studio Code to version 0.10.10 through clicking update notification on top of VS Code's window.
  4. Restart the Visual Studio Code and repeat step 2. Confirm that an error [cordova-debug-adapter] TypeError: Path must be a string. Received undefined happens.

System Environment

  • Cordova CLI: 6.0.0
  • Gulp version: CLI version 3.9.0
  • Gulp local: Local version 3.9.0
  • Ionic Version: 1.1.1
  • Ionic CLI Version: 1.7.14
  • Ionic App Lib Version: 0.7.0
  • ios-deploy version: 1.8.0
  • ios-sim version: 5.0.6
  • OS: Mac OS X El Capitan
  • Node Version: v5.7.1
  • Xcode version: Xcode 7.2 Build version 7C68

image

Debug fails with [cordova-debug-adapter] Error: Unable to find webview

I just updated my VSC with the latest 1.1.0 cordova-tools.
When I debug my Ionic2 project w/ Run on iOS Simulator, I keep getting the '[cordova-debug-adapter] Error: Unable to find webview'.
I am running mac OS El Capitan and XCode 7.3.
From my observation, this error occurs while it is trying to load the app in the simulator.
The thing is, even with this error the app eventually loads in the simulator.
But in VSC the debug has ended due to the error. So I have no way of getting the breakpoint to hit, etc.

Ionic live reload not working with iOS 9

iOS 9 has become more restrictive in the way they handle network security in apps. These changes are blocking Ionic live reload sessions on iOS 9 simulator and devices.

Workaround:

  • Add the transport-security plugin to your app: ionic/cordova plugin add cordova-plugin-transport-security. This will disable the App Transport Security in your app. You may want to remove this plugin when you are ready to publish your app, for added security.
  • Allow navigation to the Ionic dev server. To do this, add the following entry to your config.xml: <allow-navigation href="http://localhost:8100/*"/>. Replace localhost and 8100 with the address and port you are using for the Ionic dev server. You may need to add the cordova-whitelist-plugin to your app for this to be honored.
  • For the iOS simulator, using localhost as the dev server usually works (provided you have followed the above steps). To do this in our extension, add "devServerAddress": "localhost" to launch.json, in the "Run on iOS simulator" launch configuration.

More info:

See the following resources for more info, or if the above workaround steps don't work for you.
http://blog.ionic.io/preparing-for-ios-9/
https://forum.ionicframework.com/t/run-and-emulate-ios-with-live-reload-not-working-in-ios9/32670/7

Debug adapter process has terminated unexpectedly

On Linux Mint 17.2

Also, the Cordova:Run and Cordova:Build commands return

No handler found for the command: 'cordova.run'. Ensure there is an activation event defined, if you are an extension.

The cordova application was succesful created an built from command line for android platform. Only fails on vscode.

launch.json

{
    "version": "0.2.0",
    "configurations": [
         {
            "name": "Cordova",
            "type": "cordova",
            "request": "launch",
            "platform": "android",
            "target": "device"
        }
    ]
}

config.xml

<?xml version='1.0' encoding='utf-8'?>
<widget id="com.test.package" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>gxdcalidad</name>
    <description>
        A sample Apache Cordova application that responds to the deviceready event.
    </description>
    <author email="[email protected]" href="http://cordova.io">
        Apache Cordova Team
    </author>
    <content src="index.html" />
    <access origin="*" />
    <preference name="Fullscreen" value="true" />
    <preference name="DisallowOverscroll" value="true" />
    <engine name="android" spec="~4.1.1" />
    <plugin name="com.lampa.startapp" spec="~0.0.5" />
    <plugin name="cordova-plugin-whitelist" spec="1" />
    <allow-navigation href="*" />
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <allow-intent href="tel:*" />
    <allow-intent href="sms:*" />
    <allow-intent href="mailto:*" />
    <allow-intent href="geo:*" />
    <platform name="android">
        <allow-intent href="market:*" />
    </platform>
    <platform name="ios">
        <allow-intent href="itms:*" />
        <allow-intent href="itms-apps:*" />
    </platform>

</widget>

Distro details

::::::::::::::
/etc/lsb-release
::::::::::::::
DISTRIB_ID=LinuxMint
DISTRIB_RELEASE=17.2
DISTRIB_CODENAME=rafaela
DISTRIB_DESCRIPTION="Linux Mint 17.2 Rafaela"
::::::::::::::
/etc/os-release
::::::::::::::
NAME="Ubuntu"
VERSION="14.04.3 LTS, Trusty Tahr"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 14.04.3 LTS"
VERSION_ID="14.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"

*** /etc/upstream-release: directory ***

Linux Kernel

3.16.0-38-generic

Cordova

5.4.1

Android (adb)

Android Debug Bridge version 1.0.32
Revision 09a0d98bebce-android

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.