Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 356
Ryan Coolwebs Avatar asked May 21 '14 07:05

Ryan Coolwebs


People also ask

What is emulator in AVD?

An Android emulator is an Android Virtual Device (AVD) that represents a specific Android device. You can use an Android emulator as a target platform to run and test your Android applications on your PC. Using Android emulators is optional.


2 Answers

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

like image 169
Keith Avatar answered Sep 21 '22 14:09

Keith


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>" 
like image 26
kristofvdj88 Avatar answered Sep 23 '22 14:09

kristofvdj88