Android Virtual Device tips and tricks

One of the Android Developer’s best friends is the emulator (aka AVD). It allows us to simulate some behaviors, like calling, sending SMS messages, simulate a specific location and much more.

Creating an emulator

Creating an Android Virtual Device is very simple, just make sure you have the system image of the Android version you need to simulate installed.

Android Virtual Device Tips and Tricks - Android SDK Manager System Image
Android SDK Manager System Image
android create avd -n <name> -t <targetID> [-<option> <value>] ...

You can see a list of available options on the Android website

Emulator keyboard mapping

In general, I use keyboard mappings for everything. I think it makes me more productive. AVD has some nice keyboard mappings to simulate the real experience closer to a real device.

MappingDescription

ESCBack
F4Hangup/end call button
F7Power button
F8Toggle cell networking on/off
Ctrl + F5Audio volume up button
Ctrl + F6Audio volume down button
Ctrl + F11Change layout orientation

See the complete list on the Android website

Logcat

One of the most important tools for the Android developer is logcat. Logcat is a simple way to see the system logs and debugging output from device/emulator. You can use logcat from an ADB shell to view the log messages.

adb logcat

Tips and tricks

The following commands need to be run using telnet

telnet localhost [emulator port]
Android Virtual Device Tips and Tricks - Android Emulator Port
Android Emulator Port

Receiving a call

gsm call <telephone-number>

Receiving a SMS

sms send <telephone-number> <message>

Power battery

power capacity <battery %>

Network speed

network speed <download> <upload>

To see the list of available options type help inside telnet’s prompt.

Add comment

By Daniel Passos