Search code examples
cordovawindows-phone-8

Why is phonegap unable to run the wp8 emulator?


I'm on phonegap 3.7 and I'm trying to launch the emulator via:

phonegap run wp8

But if fails with:

Error: Invalid target device specified.

[..]

ERROR: Error code -2147024809 for command: C:\Program Files (x86)\Microsoft SDKs \Windows Phone\v8.0\Tools\Xap Deployment\XapDeployCmd.exe with args: /installlau nch,C:/Users/kitsunde/Development/pub_pure_app/src/platforms/wp8/Bin/debug/Cordo vaAppProj_Debug_AnyCPU.xap,/targetdevice:xd

Error: C:\Users\kitsunde\Development\pub_pure_app\src\platforms\wp8\cordova\run. bat: Command failed with exit code 2 at ChildProcess.whenDone (C:\Users\kitsunde\AppData\Roaming\npm\node_modules \phonegap\node_modules\cordova\node_modules\cordova-lib\src\cordova\superspawn.j s:135:23) at ChildProcess.emit (events.js:98:17) at maybeClose (child_process.js:766:16) at Process.ChildProcess._handle.onexit (child_process.js:833:5)

What could be causing that?


Solution

  • As of Cordova/PhoneGap 3.6, if you are trying to emulate Windows Phone 8.1, you have to use the windows platform in Cordova/PhoneGap rather than the wp8 platform.

    phonegap platforms rm wp8
    phonegap platforms add windows
    

    The Apache Cordova 3.6 release has been inspired by the idea of Building universal Windows apps. It introduces a new unified ‘windows’ platform to build apps targeting Windows 8.0, Windows 8.1 and Windows Phone 8.1. Note, Windows Phone 8.0 still remains as a separate ‘wp8’ platform due to different implementation.

    from: http://akvelon.com/apache-cordova-adds-windows-8-1-and-windows-phone-8-1-universal-apps-support/

    Got that?

    • Windows 8 > use windows platform
    • Windows 8.1 > use windows platform
    • Windows Phone 8 > use wp8 platform
    • Windows Phone 8.1 > use windows platform

    If you really just want to emulate Windows Phone 8, you probably need to install the Windows Phone 8 sdk if you haven't already.