Android Studio Emulator launcher

Kamil Szymkowski
Unpacking React Native
3 min readNov 14, 2019

--

Android Studio can be equipped with a component called Android Emulator, which can create, modify and launch Android Virtual Devices. The emulator can be accessed via GUI provided from within Android Studio called AVD Manager or from the command line. It’s hardly practical to have to open Android Studio every time the emulator needs to be launched so here’s a quick hack for launching it from a shortcut.

It’s a three-step process.

Step 1. Create AVD

First the Android Virtual Device needs to be created. This can be done using the AVD Manager or a command line tool called avdmanager (this is a different tool from the one used to launch the AVD, this tool is located at Sdk\tools\bin and is used solely for creating virtual devices).

Step 2. Check environment variables

The executable file used for launching virtual devices is located at

YOUR_INSTALL_LOCATION\Sdk\emulator

you need to ensure that this directory is listed within the system’s PATH variable (any executable file listed there can be launched from the command line without having to specify the entire path).

You might have noticed that there is an executable file also called “emulator” at:

YOUR_INSTALL_LOCATION\Sdk\tools

and that it is listed within the system’s PATH variable too. This is not your target executable and you need to ensure that that “Sdk\emulator” come before “Sdk\tools” or else it won’t work:

Step 3. Check that command works

Finally, run this command to list available virtual devices:

emulator -list-avds

You can then launch any using:

emulator -avd YOUR_DEVICE_NAME

or

emulator @YOUR_DEVICE_NAME

you may want to configure the emulator launch with additional options, which follow syntax:

emulator @YOUR_DEVICE_NAME -option_a -option_b -option_c

Step 4. Create shortcut

There are several ways to do it.

You can copy the command (including the full path):

FULL_PATH\Sdk\emulator @YOUR_DEVICE_NAME

into a text editor and save it with .CMD extension.

Another approach is to create a tab launcher by defining a task within Cmder.

There you need to specify the icon in the task parameter window:

/icon "PATH_TO_YOUR_ICON"

and the command to be executed in the commands window:

cmd /k emulator @"NAME_OF_YOUR_DEVICE"  -new_console:t:"TAB_NAME":d:"PATH_TO_INSTALL\Sdk\emulator"

The end result

--

--