How to run Android emulator via command line

Android SDK and emulator tool

First make sure that you have access to the emulator tool from the command line. The emulator tool comes bundled with the Android SDK and the correct path to it is, from Android SDK folder:

emulator/emulator.exe

on Windows

Important: This should be the executable acessible in the command line, and not the one in tools/emulator.exe. This is a common problem that people face when using this tool, so check if you have the correct executable in your Path variable.

AVD devices

This article does not cover how to create a Android Virtual Device (AVD). Assuming that you have at least one AVD, let’s procced.

List AVDs

To have a list of the availables AVDs, run the command below:

emulator -list-avds

Shows the list of AVDs installed

It should print the a list of AVD IDs. Grab the desired AVD ID (Ex.: Samsung_A30S_API_28) and let’s proceed.

Running the AVD

With the AVD ID in hands, execute the command below to run the emulator:

emulator @<AVD_ID>

Replace the <AVD_ID> with the desired AVD ID selected in the previous section. It should look like this: emulator @Samsung_A30S_API_28

Do not forget to put an @ symbol right before the AVD ID.

That’s it. If everything go right the emulator window should open right after. If you have an error check if you are using the correct emulator tool (first section) or if you got the right AVD ID (List AVDs section).

TL;DR

Command list:

emulator -list-avds

emulator @<AVD_ID>

Deixe uma resposta

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *