Connect your desktop to an Android emulator with adb

Install adb, start an Android Virtual Device from the terminal, connect to it, install an APK, open a shell, and let the emulator reach a dev server on your machine.

9 steps⏱ 15 minBeginnerLinux · macOS · Windows✓ Verified 4 Nov 2026

Showing commands for This recipe doesn't cover this OS yet.

adb (Android Debug Bridge) is how your desktop talks to an Android device. An emulator counts as a device. Once it’s connected you can install apps, read logs, open a shell, and forward ports.

Already have Android Studio? It ships adb and the emulator inside your Android SDK. You can skip downloading in step 1 and just add them to your PATH in step 2.

Get adb (SDK Platform-Tools)

If you don’t use Android Studio, download Google’s standalone Platform-Tools package (latest is 37.0.1, July 2026) and unzip it.

Linuxbash
cd ~
curl -LO https://dl.google.com/android/repository/platform-tools-latest-linux.zip
unzip platform-tools-latest-linux.zip
# adb is now in ~/platform-tools/
macOSzsh
cd ~
curl -LO https://dl.google.com/android/repository/platform-tools-latest-darwin.zip
unzip platform-tools-latest-darwin.zip
# adb is now in ~/platform-tools/
WindowsPowerShell
cd $HOME
curl.exe -LO https://dl.google.com/android/repository/platform-tools-latest-windows.zip
Expand-Archive .\platform-tools-latest-windows.zip -DestinationPath $HOME
# adb.exe is now in $HOME\platform-tools\

Nothing to run on for this part.

The emulator itself is not in Platform-Tools. Install it in Android Studio under SDK Manager → SDK Tools → Android Emulator.

Put adb and the emulator on your PATH

Point ANDROID_HOME at your SDK folder and add platform-tools and emulator to PATH. The paths below are Android Studio’s default SDK locations. Change them if you installed the SDK somewhere else.

Linuxbash
echo 'export ANDROID_HOME="$HOME/Android/Sdk"' >> ~/.bashrc
echo 'export PATH="$PATH:$ANDROID_HOME/platform-tools:$ANDROID_HOME/emulator"' >> ~/.bashrc
source ~/.bashrc
macOSzsh
echo 'export ANDROID_HOME="$HOME/Library/Android/sdk"' >> ~/.zprofile
echo 'export PATH="$PATH:$ANDROID_HOME/platform-tools:$ANDROID_HOME/emulator"' >> ~/.zprofile
source ~/.zprofile
WindowsPowerShell
$sdk = "$env:LOCALAPPDATA\Android\Sdk"
[Environment]::SetEnvironmentVariable("ANDROID_HOME", $sdk, "User")
$userPath = [Environment]::GetEnvironmentVariable("Path", "User")
[Environment]::SetEnvironmentVariable("Path", "$userPath;$sdk\platform-tools;$sdk\emulator", "User")
# Close and reopen Windows Terminal so the new PATH is picked up.

Nothing to run on for this part.

Used the standalone zip from step 1 with no Android Studio? Add ~/platform-tools (Windows: $HOME\platform-tools) to PATH instead.

Check that adb works

All systemsbash
adb version
All systemsExpected output
Android Debug Bridge version 1.0.41
Version 37.0.1-...
Installed as /.../platform-tools/adb

Nothing to run on for this part.

Find your virtual device’s name

List the AVDs you’ve created. Copy the one you want into Your values → Virtual device (AVD) name.

All systemsbash
emulator -list-avds
All systemsExpected output
Pixel_8_API_35
Medium_Phone_API_36

Nothing to run on for this part.

Linux: check that hardware acceleration (KVM) is available with emulator -accel-check. Without it the emulator is very slow or won’t start.

Start the emulator

Run this in its own terminal tab. It keeps running while the emulator is open.

All systemsbash
emulator -avd Pixel_8_API_35

Nothing to run on for this part.

Useful options: -no-snapshot-load for a cold boot, -wipe-data to factory-reset the device, and -no-window to run headless on a server or in CI.

Newer option: Google now marks the standalone emulator tool as deprecated in favour of the Android CLI. If you have it installed, android emulator list and android emulator start Pixel_8_API_35 do the same thing (add --headless for no window).

Confirm adb sees the emulator

In a second terminal:

All systemsbash
adb devices -l
All systemsExpected output
List of devices attached
emulator-5554          device product:sdk_gphone64_x86_64 model:sdk_gphone64_x86_64 device:emu64xa transport_id:1

Nothing to run on for this part.

If it says offline, wait for the emulator to finish booting. Each emulator uses two ports: a console port (5554) and an adb port (5555). A second emulator gets 5556/5557, and so on, so its serial is emulator-5556.

Install your app

Use -s to choose the device when more than one is connected.

All systemsbash
adb -s emulator-5554 install app/build/outputs/apk/debug/app-debug.apk
All systemsExpected output
Performing Streamed Install
Success

Nothing to run on for this part.

Open a shell, read logs, take a screenshot

All systemsbash
# Interactive shell on the device (type `exit` to leave)
adb -s emulator-5554 shell

# Live logs (Ctrl+C to stop)
adb -s emulator-5554 logcat

# Screenshot straight to your desktop
adb -s emulator-5554 exec-out screencap -p > screen.png
WindowsPowerShell
# Interactive shell on the device (type `exit` to leave)
adb -s emulator-5554 shell

# Live logs (Ctrl+C to stop)
adb -s emulator-5554 logcat

# Screenshot: save on the device, then pull it to your PC
adb -s emulator-5554 shell screencap /sdcard/screen.png
adb -s emulator-5554 pull /sdcard/screen.png .

Nothing to run on for this part.

On Windows, PowerShell’s > can corrupt binary data, so the screenshot is saved on the device first and then copied with adb pull.

Let the emulator reach a server on your desktop

Run your dev server (Metro, Vite, an API…) on your desktop. Then adb reverse makes localhost:8081 inside the emulator point to the same port on your desktop.

All systemsbash
adb -s emulator-5554 reverse tcp:8081 tcp:8081
adb -s emulator-5554 reverse --list
All systemsExpected output
UsbFfs tcp:8081 tcp:8081

Nothing to run on for this part.

Reverse rules need Android 5.0+ and are lost when the emulator restarts or the adb server restarts, so run this again after either. The opposite direction also works. adb forward tcp:6100 tcp:7100 sends your desktop’s port 6100 to port 7100 on the device.

Troubleshooting

adb: command not found / 'adb' is not recognized: your PATH change hasn’t loaded. Open a new terminal, or run source ~/.bashrc (Linux) or source ~/.zprofile (macOS).

The emulator is running but not in adb devices: restart the adb server:

All systemsbash
adb kill-server
adb start-server
adb devices

Nothing to run on for this part.

more than one device/emulator: add -s emulator-5554 to the command, or set ANDROID_SERIAL=emulator-5554 for the session.

The emulator won’t start on Linux: run emulator -accel-check. If KVM isn’t available, turn on virtualization (VT-x/AMD-V) in your BIOS/UEFI.

Clean up

All systemsbash
# Remove port reverses and stop the emulator
adb -s emulator-5554 reverse --remove-all
adb -s emulator-5554 emu kill

Nothing to run on for this part.

Sources

Commands checked against these official sources on 4 Nov 2026. Found something out of date? Open an issue.

  1. Android Debug Bridge (adb) · Android Developers
  2. Start the emulator from the command line · Android Developers
  3. SDK Platform-Tools release notes (latest 37.0.1) · Android Developers · July 2026
  4. Environment variables (ANDROID_HOME) · Android Developers
  5. Send emulator console commands (adb emu kill) · Android Developers
  6. adb reverse (community reference; also listed in `adb --help`) · LinuxCommandLibrary
  7. Android CLI, android emulator start · Android Developers · Page updated 2026-10-28