Skip to content

Instantly share code, notes, and snippets.

@mattijsf
Forked from hkhc/create_avd.md
Created July 30, 2019 08:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattijsf/117b19e4c792feec5e6053a096ffe0c5 to your computer and use it in GitHub Desktop.
Save mattijsf/117b19e4c792feec5e6053a096ffe0c5 to your computer and use it in GitHub Desktop.
Creating and launching Android emulator AVD properly

Creating AVD

avd_name=my_avd
api_level=23
abi=x86_64
tag=google_apis
device="Nexus 5" # list of available devices see below

${ANDROID_HOME}/tools/bin/avdmanager --verbose create avd --name ${avd_name} \
                            --package "system-images;android-${api_level};${tag};${abi}" \
                            --device "$device"

Launching AVD

Note that -skin option can be resolution (in the form 'height'x'width') of emulator rather than real skin name

${ANDROID_HOME}/tools/emulator @${avd_name} -skin "1920x1080"

List of available devices

The valid device names are hardcoded in ${ANDROID_HOME}/tools/lib/sdklib-26.0.0-dev.jar where 26.0.0 can be replaced by your build tools version.

Extract the following files:

jar -xf ${ANDROID_HOME}/tools/lib/sdklib-26.0.0-dev.jar com/android/sdklib/devices
grep -r "d:id" com/android/sdklib/devices/*.xml | sed 's/^.*\<d:id\>//g' | sed 's/\<\/d:id\>//g'

The list for my SDK is:

2.7in QVGA
2.7in QVGA slider
3.2in HVGA slider (ADP1)
3.2in QVGA (ADP2)
3.3in WQVGA
3.4in WQVGA
3.7in WVGA (Nexus One)
3.7 FWVGA slider
4in WVGA (Nexus S)
4.65in 720p (Galaxy Nexus)
4.7in WXGA
5.1in WVGA
5.4in FWVGA
7in WSVGA (Tablet)
10.1in WXGA (Tablet)
Nexus 7
Nexus 7 2013
Nexus 5
Nexus 6
Nexus 9
Nexus 5X
Nexus 6P
pixel_c
pixel
pixel_xl
tv_1080p
tv_720p
wear_square
wear_round
wear_round_chin_320_290
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment