vscode-cordova icon indicating copy to clipboard operation
vscode-cordova copied to clipboard

Spawn EINVAL error when launching Android emulator

Open Lukenickerson opened this issue 5 months ago • 4 comments

Actual Behavior

  1. Started with an existing cordova project that had been working in the emulator in the past
  2. Created a new launch.json file with Cordova debug configuration (see https://github.com/microsoft/vscode-cordova/issues/994)
  3. Selected "Debug Android on emulator" which does a launch
  4. Selected the name of the emulator "PixelCAndroid13API33" (this seems to alter the launch.json)
  5. Emulator starts up OK
  6. Problems: (See screenshot 1 below)
    • Cordova android app does not start up
    • Error "spawn EINVAL" error is shown in debug console
    • Blue indicator on left is shown and animated (going left to right) as if there is still something happening, even though nothing is happening
    • Debug options are shown, requiring a "Stop"
  7. If I then stop the debugger, and select "Attach to running Android on emulator" from the debug menu, while the emulator is running, I get: (See screenshot 2 below)
    • Cordova android app does not start up
    • Error "Unable to find 'localabstract' name of Cordova app (error code 406)" is shown

Expected Behavior

  1. Cordova android app should start up in the emulator
  2. No "spawn EINVAL" error message, OR additional information which helps debug the underlying problem
  3. Indicator at left should not be shown if nothing is happening or the user may wait
  4. Debug options should not be shown

Software versions

  • Cordova VS Code extension version: 2.7.0
  • VSCode version: 1.92.2
  • OS platform and version: Windows 10
  • NodeJS version: 20.5.0
  • Cordova version: 12.0.0
  • Cordova-Android/iOS/Windows version: 13.0.0

Outputs (Include if relevant)

Debug (launch) error:

image

Attach error:

image

  • Output of the Debug Console (View -> Toggle Debug Console):
Launching for android (This may take a while)...
spawn EINVAL
  • Output of the Cordova output channel (View -> Toggle Output -> Select Cordova in ListBox):
Launched emulator PixelCAndroid13API33
  • Output of the Developer Tools console (Help -> Toggle Developer Tools -> Select Console tab):
register @ TMScopeRegistry.ts:46
log.ts:419  INFO [perf] Render performance baseline is 53ms
webviewElement.ts:482 An iframe which has both allow-scripts and allow-same-origin for its sandbox attribute can escape its sandboxing.
mountTo @ webviewElement.ts:482
workbench.html:1 Third-party cookie will be blocked. Learn more in the Issues tab.
webviewElement.ts:482 An iframe which has both allow-scripts and allow-same-origin for its sandbox attribute can escape its sandboxing.
mountTo @ webviewElement.ts:482
webviewElement.ts:482 An iframe which has both allow-scripts and allow-same-origin for its sandbox attribute can escape its sandboxing.
mountTo @ webviewElement.ts:482
webviewElement.ts:482 An iframe which has both allow-scripts and allow-same-origin for its sandbox attribute can escape its sandboxing.
mountTo @ webviewElement.ts:482
log.ts:439   ERR [Extension Host] Error while detecting Ionic CLI version TypeError: Cannot read properties of null (reading 'toString')
	at h.getIonicCliVersion (.vscode\extensions\msjsdiag.cordova-tools-2.7.0\dist\cordova-extension.js:4:527569)
	at h.isIonicCliVersionGte (.vscode\extensions\msjsdiag.cordova-tools-2.7.0\dist\cordova-extension.js:4:527659)
	at new f (.vscode\extensions\msjsdiag.cordova-tools-2.7.0\dist\cordova-extension.js:4:533857)
	at F.<anonymous> (.vscode\extensions\msjsdiag.cordova-tools-2.7.0\dist\cordova-extension.js:4:450534)
	at Generator.next (<anonymous>)
	at s (.vscode\extensions\msjsdiag.cordova-tools-2.7.0\dist\cordova-extension.js:4:441086)
console.ts:137 [Extension Host] Error while detecting Ionic CLI version TypeError: Cannot read properties of null (reading 'toString')
	at h.getIonicCliVersion (.vscode\extensions\msjsdiag.cordova-tools-2.7.0\dist\cordova-extension.js:4:527569)
	at h.isIonicCliVersionGte (.vscode\extensions\msjsdiag.cordova-tools-2.7.0\dist\cordova-extension.js:4:527659)
	at new f (.vscode\extensions\msjsdiag.cordova-tools-2.7.0\dist\cordova-extension.js:4:533857)
	at F.<anonymous> (.vscode\extensions\msjsdiag.cordova-tools-2.7.0\dist\cordova-extension.js:4:450534)
	at Generator.next (<anonymous>)
	at s (.vscode\extensions\msjsdiag.cordova-tools-2.7.0\dist\cordova-extension.js:4:441086)
y @ console.ts:137
console.ts:137 [Extension Host] rejected promise not handled within 1 second: Error: Error while executing command 'adb -s "emulator-5554" forward --remove tcp:9222': Command failed: adb -s "emulator-5554" forward --remove tcp:9222
adb.exe: error: listener 'tcp:9222' not found

y @ console.ts:137
console.ts:137 [Extension Host] stack trace: Error: Error while executing command 'adb -s "emulator-5554" forward --remove tcp:9222': Command failed: adb -s "emulator-5554" forward --remove tcp:9222
adb.exe: error: listener 'tcp:9222' not found

	at o.getNestedError (.vscode\extensions\msjsdiag.cordova-tools-2.7.0\dist\cordova-extension.js:4:407832)
	at .vscode\extensions\msjsdiag.cordova-tools-2.7.0\dist\cordova-extension.js:4:415532
	at ChildProcess.exithandler (node:child_process:431:5)
	at ChildProcess.emit (node:events:519:28)
	at maybeClose (node:internal/child_process:1105:16)
	at ChildProcess._handle.onexit (node:internal/child_process:305:5)
y @ console.ts:137
mainThreadExtensionService.ts:78 [msjsdiag.cordova-tools]Error while executing command 'adb -s "emulator-5554" forward --remove tcp:9222': Command failed: adb -s "emulator-5554" forward --remove tcp:9222
adb.exe: error: listener 'tcp:9222' not found

$onExtensionRuntimeError @ mainThreadExtensionService.ts:78
mainThreadExtensionService.ts:79 Error: Error while executing command 'adb -s "emulator-5554" forward --remove tcp:9222': Command failed: adb -s "emulator-5554" forward --remove tcp:9222
adb.exe: error: listener 'tcp:9222' not found

	at o.getNestedError (.vscode\extensions\msjsdiag.cordova-tools-2.7.0\dist\cordova-extension.js:4:407832)
	at .vscode\extensions\msjsdiag.cordova-tools-2.7.0\dist\cordova-extension.js:4:415532
	at ChildProcess.exithandler (node:child_process:431:5)
	at ChildProcess.emit (node:events:519:28)
	at maybeClose (node:internal/child_process:1105:16)
	at ChildProcess._handle.onexit (node:internal/child_process:305:5)

Lukenickerson avatar Aug 29 '24 15:08 Lukenickerson