Can I select a particular Android Device Emulator from AVD using Apache Cordova?

25,829

Solution 1

Use the target parameter like this:

cordova emulate --target=emulator-5554 android

To get the device name of your emulator ("emulator-5554" in this example), run /platforms/android/cordova/lib/list-started-emulators.bat

Solution 2

If you run the following command you will get a list of all available devices:

cordova run android --list

enter image description here

Next you can emulate your app by running:

cordova run android --target="<Device_Name>"

Solution 3

For me:

If you use OSX, you can open shell in /platforms/android/cordova/lib/ as stated, and write the next command:

./list-emulator-images

after you've gotten the emulator image name,

cordova emulate android --target="the name"
Share:
25,829
Ryan Coolwebs
Author by

Ryan Coolwebs

Updated on June 08, 2020

Comments

  • Ryan Coolwebs
    Ryan Coolwebs almost 4 years

    Is there a way when using Cordova CLI to select a particular emulated device from the Android Device Manager (AVD)?

    I am working on a tablet app and a smartphone app at the same time and need to switch to different types of emulators because of the different form factors and screen resolutions?

    I know it's not a particular coding question but perhaps there is some Cordova code I can run in terminal to make the emulation more specific rather than:

    cordova emulate android
    

    Which seems to pick the first emulator off the stack.