Android emulator cheatsheet

Lately, I’ve been testing some mobile web apps using the android emulator.  It’s a piece of software that I use infrequently enough that I can’t remember some needed commands.

Launching the emulator

$PATH_TO_ADT_BUNDLE/sdk/tools/emulator -avd $AVD_NAME

~/local/adt-bundle-linux-x86-20130729/sdk/tools/emulator -avd AVD_for_Galaxy_Nexus_by_Google

Note: AVDs are stored in ~/.android/avd

Launching the Android Virtual Device (AVD) manager

$PATH_TO_ADT_BUNDLE/sdk/tools/android avd

Switching screen orientation

Switch to previous layout orientation (for example, portrait, landscape): KEYPAD_7, Ctrl-F11

Switch to next layout orientation (for example, portrait, landscape): KEYPAD_9, Ctrl-F12

Source

Accessing servers running on localhost

Use 10.0.2.2

Source

Debugging JavaScript in the Android Browser

console.log() will output to the log stream viewable with the adb logcat command.

You can filter the logs to only see the browser messages by using

adb logcat browser:* *:S

Source