26 lines
842 B
Bash
26 lines
842 B
Bash
#!/usr/bin/bash
|
|
|
|
BASENAME='root34'
|
|
MAX_EMU=10
|
|
LOG_DIR=${1:-$(mktemp -d)}
|
|
START_PORT=5554
|
|
|
|
# kill all emulators:
|
|
# for e in $(adb devices | grep emulator | sed 's/\t.*//'); do adb -s $e emu kill; done
|
|
# and for the few that refuse to die after a few moments:
|
|
# pkill -f /home/android/Android/Sdk/emulator/qemu/linux-x86_64/qemu-system-x86_64-headless
|
|
|
|
echo "Emulator Log DIR: ${LOG_DIR}"
|
|
|
|
for i in $(seq 1 "${MAX_EMU}"); do
|
|
CONSOLE_PORT=$((START_PORT++))
|
|
ADB_PORT=$((START_PORT++))
|
|
adb devices | grep -q "emulator-${CONSOLE_PORT}"
|
|
if [ $? -ne 0 ]
|
|
then
|
|
echo "start ${BASENAME}-${i} (emulator-${CONSOLE_PORT})"
|
|
emulator -avd "${BASENAME}-${i}" -no-window -no-metrics -ports "${CONSOLE_PORT},${ADB_PORT}" > "${LOG_DIR}/emulator-${CONSOLE_PORT}.stdout" 2> "${LOG_DIR}/emulator-${CONSOLE_PORT}.stderr" &
|
|
sleep 2
|
|
fi
|
|
done
|