How do I launch the Android emulator from the command line?
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.
Introduction
Launching the Android emulator from the command line is useful for automation, CI jobs, and plain day-to-day development when you do not want to open Android Studio just to boot a device. The workflow is simple once three pieces are in place: the SDK paths, an AVD definition, and the emulator command itself.
The important detail is that adb does not launch an emulator. adb talks to devices after they exist. Creating and starting the emulator is handled by avdmanager and emulator.
Make Sure the SDK Tools Are on Your Path
The modern SDK layout usually needs these directories available:
Then verify the tools:
If emulator or avdmanager is not found, the path is still wrong or the command-line tools are not installed.
List Existing Virtual Devices
If you already created an emulator device in Android Studio or with avdmanager, list it like this:
That prints names such as:
Once you have a valid AVD name, launch it with:
That is the core answer.
Create an AVD From the Command Line
If no virtual device exists yet, install a system image and create one. First, install the package:
Then create the AVD:
Now boot it:
If the device name is not accepted, run avdmanager list device and choose one from the installed definitions.
Useful Startup Flags
The emulator command supports many options. A few are especially practical:
Typical uses:
- '
-no-boot-animspeeds up startup during test runs' - '
-no-windowis useful in headless environments' - '
-wipe-dataresets the emulator to a clean state'
Be careful with -wipe-data because it erases the device state for that AVD.
Wait Until the Emulator Is Actually Ready
A common mistake is starting the emulator and immediately trying to install an APK. The process may exist, but Android might still be booting. Use adb to wait:
After that, commands such as installation or instrumentation are much more reliable:
Multiple Emulators and Device Selection
If more than one emulator or phone is connected, adb needs a target serial. List devices first:
Then address a specific emulator:
This matters in CI or on developer machines with a physical phone connected.
Common Pitfalls
The most common mistake is using adb as if it creates emulators. It does not. Use emulator -avd ... to boot the device and adb only after it appears.
Another common issue is relying on older path examples that include legacy tools directories. On modern SDK setups, cmdline-tools/latest/bin is the important path for avdmanager.
Teams also start tests too early. A visible emulator window does not guarantee that Android finished booting. Always wait for sys.boot_completed or an equivalent readiness check.
Finally, when emulator -list-avds shows nothing, the problem is not the launch command. It means no AVD has been created yet under the current SDK and user profile.
Summary
- Use
emulator -list-avdsto discover available virtual devices. - Launch one with
emulator -avd AVD_NAME. - Create new devices with
sdkmanagerandavdmanagerwhen needed. - Use
adbafter boot to install apps and run commands. - For automation, wait until
sys.boot_completedreports1before continuing.
Related reading
- How do I load an HTTP URL with App Transport Security enabled in iOS 9?
- How do I locate the CGRect for a substring of text in a UILabel?
- How do I make a custom initializer for a UIViewController subclass in Swift?
- How do I make a dotted/dashed line in Android?
- How do I log a Python error with debug information?
- How do I obtain crash-data from my Android application?
- How do I make a new line in swift
- How do I make an attributed string using Swift?
.png&w=3840&q=75)
Tackling System Design Interview Problems
A short course that equips you with the skills to approach system design interviews methodically.
Start the free courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.