microsoft / vscode-cordova

A Visual Studio Code extension providing intellisense, debug, and build support for Cordova and Ionic projects.
https://marketplace.visualstudio.com/items?itemName=vsmobile.cordova-tools
Other
292 stars 67 forks source link

Cordova options not included in vs code debug #948

Closed chitgoks closed 7 months ago

chitgoks commented 7 months ago

Actual Behavior

  1. WHile the screenshots of this github page look different for vscode, my version has a run and debug button. when clicked, the cordova option is not included.

Expected Behavior

  1. Cordova should be seen in the debug list options

Software versions

Cordova tools extension has already been installed.

EzioLi01 commented 7 months ago

Hey @chitgoks, please using launch.json to add your cordova debug configure.

chitgoks commented 7 months ago

hi @EzioLi01 i thought once you choose cordova in the list, a launch.json is created for you. so you have to manually create launch.json? can you please include in the docs how to, after creating launch.json what to do next? can help newbies.

EzioLi01 commented 7 months ago

Hey @chitgoks , after creating launch.json file, you can click Add configuration button and in the list you can see cordova debugging options. Normally I suggest that you can using Android emulator(Run Android on emulator) or browser(Run Browser) for debugging. For iOS debugging, we used a 3rd party tool to setup debugging proxy, but it does not support some latest iOS versions. So if you failed on iOS debugging in latest iOS version, you can replace it by browser debugging. image

EzioLi01 commented 7 months ago

Hey @chitgoks , do you have any update or question on this?

chitgoks commented 7 months ago

hi @EzioLi01 ill get back to you. was away. will check next week.

EzioLi01 commented 7 months ago

Cool, thanks!

chitgoks commented 7 months ago

@EzioLi01 thanks! it works. so it has to be manual now.

i have another question. once i start debugging the simulator does not get launched. this is my configuration. it says unable to find webview (error code 407) - might not be related to cordova?

"configurations": [ { "name": "Run iOS on simulator - experimental", "type": "cordova", "request": "launch", "platform": "ios", "target": "C53F9B86-E222-4FA8-ADA3-1000E2EE93AF", "port": 9220, "sourceMaps": true, "cwd": "${workspaceFolder}" } ]

EzioLi01 commented 7 months ago

@chitgoks If you're using the latest iOS I think it's some limitations in 3rd party ios proxy tools in our extension. Also cordova-ios also have some issues when launching simulator. If you're failed to work on simulator, I suggestion that you can try to use Run Browser to simulate and debug you app in browser.

chitgoks commented 7 months ago

sorry. i actually gave up. still have no progress finding the cause why

once deployed to ios simulator, the cordova variable is undefined.

once deployed to android emulator, in debug it says website not available and the app crashes when run with the message err_connection_refused.

tried everything i could find in the web but to no avail. most of the tutorials/posts though are old and im using the latest versions of libs e.g. agp 8.2, gradle 8,.5, cordova 12, jdk 21

EzioLi01 commented 7 months ago

Sorry, I cannot repro this issue in my local, it may be caused by some specific settings or components in your project. If you still want to dig it out, is it possible if you can share some demo to repro it?

chitgoks commented 7 months ago

can i email the project to you or i post it here? its small. im just trying to see how to package an angular app using cordova.

On Tue, Feb 20, 2024, 9:56 AM Ezio Li @.***> wrote:

Sorry, I cannot repro this issue in my local, if you still want to dig it out, is it possible if you can share some demo to repro it?

— Reply to this email directly, view it on GitHub https://github.com/microsoft/vscode-cordova/issues/948#issuecomment-1953366480, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA6FWDS3773ENNITAJ3ZHIDYUP7GTAVCNFSM6AAAAABDHYKB52VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNJTGM3DMNBYGA . You are receiving this because you were mentioned.Message ID: @.***>

EzioLi01 commented 7 months ago

Sounds good if you can add demo here.

chitgoks commented 7 months ago

my-app.zip @EzioLi01 here it is. to summarize

my issue here in : 1) ios - when debugged, the console says variable cordova is undefined 2) android - when app is run, prompts err_connection_refused. in console, it says website not available.

And this is the tutorial i followed: https://medium.com/@abayomismart/creating-android-ios-app-with-cordova-and-angular-e3cf82d4cbc2

thank you for entertaining this.

EzioLi01 commented 7 months ago

@chitgoks One thing I want to confirm, can you run all scenarios successfully according to this tutorial without debugging?

chitgoks commented 7 months ago

both, no. without debugging in

ios - just a blank white screen android - dialog prompt with message err_connection_refused.

EzioLi01 commented 7 months ago

@chitgoks Actually I think it's not an extension issue. But I will still help to look into it. Any updates will comment here.

chitgoks commented 7 months ago

Hi @EzioLi01 yes. it is not an extension issue. thank you for wanting to help out.

EzioLi01 commented 7 months ago

I have a try on this but also get error on this, I'm not sure for the root cause, but this tutorial is a little bit obsoleted. I suggest that you can create an issue on cordova official repo to get some help. Thanks!