Running AVDs from the command line
Wouldn't it be nice if we could run different AVDs from the command line and perhaps automate the way we run or script our tests?
By freeing the AVD from its UI window, we open a whole new world of automation and scripting possibilities.
Well, let's explore these alternatives.
Headless emulator
A headless emulator (its UI window is not displayed) comes in very handy when we run automated tests and nobody is looking at the window, or the interaction between the test runner and the application is so fast that we hardly see anything.
Also, it is worth mentioning that, sometimes, you can't understand why some tests fail until you see the interaction on the screen, so use your own judgment when selecting a running mode for your emulator.
One thing that we may have noticed while running AVDs is that their network communication ports are assigned at runtime, incrementing the last used port by 2
and starting with 5554
. This is used to name the emulator...