Skip to content

Latest commit

 

History

History
97 lines (64 loc) · 1.28 KB

File metadata and controls

97 lines (64 loc) · 1.28 KB

1. List All Available Emulators (AVDs)

emulator -list-avds

This shows the names of all installed emulators (e.g. Pixel_5_API_34).


2. List Running Devices & Find Offline Ones

adb devices

Example output:

List of devices attached
emulator-5554   device
emulator-5556   offline

Here, emulator-5556 is offline.


3. Kill an Offline Emulator

adb -s emulator-5556 emu kill

4. Start an Emulator by Name

emulator -avd <avd_name>

Example:

emulator -avd Pixel_5_API_34

5. Script: Auto-restart Offline Emulators

Linux/macOS (bash):

for dev in $(adb devices | grep offline | awk '{print $1}'); do
  adb -s $dev emu kill
done

for avd in $(emulator -list-avds); do
  emulator -avd $avd -netdelay none -netspeed full &
done

Windows (PowerShell):

# Kill offline emulators
adb devices | ForEach-Object {
  if ($_ -match "offline") {
    $id = ($_ -split "\s+")[0]
    adb -s $id emu kill
  }
}

# Start all AVDs
emulator -list-avds | ForEach-Object {
  Start-Process emulator -ArgumentList "-avd $_ -netdelay none -netspeed full"
}

⚡ After running, check again:

adb devices

You should see them as device, not offline.