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


Accessing servers running on localhost



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


Installing CyanogenMod 10.1 on an HTC One V (CDMA) phone

My weekend project was installing CyanogenMod 10.1 on an HTC One V phone that I got from my housemate. The phone is made for Virgin Mobile, which uses a CDMA network. The codename I’ve seen for the phone is primoc, though I don’t quite understand how the naming convention works.  The process took me about a day and a half, though it would have only been a couple of hours if I would have realized I needed to activate the phone before I installed the custom ROM and if my backup would have worked correctly.

I’m not quite sure how to write up my experience, but I wanted to share a few warnings or things that would have saved me time and weren’t included in many of the guides.

The ROM zipfiles are hundreds of MBs

Take this into account when planning the time that you need.

Think of the process as multiple steps

A lot of guides combine these into one guide, or gloss over components. I found it helpful to research and understand each task, and also for time-boxing the process.

  1. Unlock bootloader
  2. Install custom recovery image. In this case, this was ClockworkMod Recovery (CWM)
  3. Copy the CyanogenMod and Google Apps distributions (zip files) to the SD card
  4. Install CyanogenMod and Google Apps from the zip files using CWM
  5. Flash the CyanogenMod boot image using fastboot

You don’t have to install any special drivers when using Ubuntu

To run the platform tools on Ubuntu, you need to run then using sudo, e.g.:

sudo ./fastboot flash boot boot.img

Activate the phone first!

The biggest time suck of the process is that I forgot to activate the phone before flashing CyanogenMod. The backup I made didn’t work.  In order to activate the phone (or switch it to your number), you need to use Virgin’s Activate app and this is only available on the stock ROM.  Save some pain and activate the phone using the default ROM before messing around with flashing custom ROMs. Luckily, I found this ROM based on the stock ROM which included the activate app.

There isn’t a RUU for newer versions of this phone

RUU stands for ROM Update Utility. It’s a windows executable used to restore the phone to a default install.

Useful resources

I used these as references during my install: