DaveB
DaveB

Reputation: 25

Cordova using Microsoft Android Emulator

I'm using cordova 6.2 and would like to use the 'microsoft android emulator' so I don't have to turn hyper-v on and off as I switch from android to windows phone emulators. The emulator (installed from link below) is installed and running correctly.
Two are installed, so I'd like to use the one with the name of '5" kitKat (4.4) XXHDPI Phone'.

My question is how do I target that emulator when using the Cordova command line. I've tried: cordova emulate android --target='5" kitKat (4.4) XXHDPI Phone'

It doesn't seem to be like that, because of the double quote for the 5". I've also tried using the identifier with no success.

I'm not looking for an answer of using the VS IDE. I want to solve this using the cordova cli. Thanks.

Link to Emulator:

https://www.visualstudio.com/en-us/features/msft-android-emulator-vs.aspx

Upvotes: 1

Views: 592

Answers (1)

QuickFix
QuickFix

Reputation: 11721

I've installed and tested the microsoft emulator (thank you for the info, it works great and emulates wifi wich is really great).

It seems the MS emulator is seen as a device, not an emulator and is not listed as an emulator.

If you run

cordova run android --list

The MS emulator images will not be listed as virtual devices, but any started emulator will be seen as physical device.

So to use it with cordova you have to use the same commands as if you wanted to run on a physical device.

If you have no device plugged in you just have to start your emulator and then run the command :

cordova run android

and adb will automatically detect the emulator.

If you have devices plugged or several emulators started, use the --target option to specify on which target you want to run :

>adb devices
List of devices attached
169.254.138.177:5555    device
9bdb6c40        device    
>cordova run android --target 169.254.138.177:5555

Upvotes: 2

Related Questions