Created
May 15, 2025 03:00
-
-
Save bryanmylee/1f54e3fc4b6eadbd9e0b424f8bcb65a8 to your computer and use it in GitHub Desktop.
Get the device ID for a given AVD name
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
TARGET_AVD_NAME=$1 | |
for id in $(adb devices | grep emulator | cut -f1); do | |
name=$(adb -s $id emu avd name | head -1 | tr -d '\r') | |
if [ "$name" = "$TARGET_AVD_NAME" ]; then | |
echo "$id" | |
break | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment