Skip to content

Instantly share code, notes, and snippets.

@dan-mckay
Last active December 22, 2015 05:29
Show Gist options
  • Save dan-mckay/6424249 to your computer and use it in GitHub Desktop.
Save dan-mckay/6424249 to your computer and use it in GitHub Desktop.
Managing Android emulators from the command line.

###Managing Android Virtual Devices (AVDs) from the Command Line

First, view a list of Android system image targets on your local machine

android list targets

Sample output:

id: 1 or "android-16"
 Name: Android 4.1.2
 Type: Platform
 API level: 16
 Revision: 4
 Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800
 ABIs : armeabi-v7a, mips, x86

To create an emulator, a command following this format is required:

android create avd -n <name> -t <targetID> [-<option> <value>] ... 

The arguments are name, system target ID and options. For example if we were to create a virtual device called "myPhone16", targeting the above system image, the following command would work:

android create avd -n myPhone16 -t 1

The options are not required and allow you to customise the "hardware" of the emulator, e.g. modifying screen resolution etc. Check out the docs to see what it can do.

To list the available AVDs installed on your local machine, enter this command:

android list avd

Sample output:

Available Android Virtual Devices:
 Name: myPhone16
 Path: <path to android sdk>
 Target: Android 4.1.2 (API level 16)
 ABI: armeabi-v7a
 Skin: WVGA800

To launch the emulator:

emulator -avd myPhone16

When the emulator is running, check if it can be seen by the Android Debug Bridge - adb

adb devices -l

Sample output:

List of devices attached
emulator-5554          device

Finally, install your application:

adb install ~/path/to/your/android.apk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment