user1589188
user1589188

Reputation: 5736

How to get the equivalent command line in AVD manager used to start Android emulator

I am thinking the AVD manager is actually calling the emulator CLI behind the scene to start emulators. Is there a way to see the actual command called (like a verbose print out)? Obviously one can always construct the command line arguments accordingly, this question is just asking for an easy way to generate the command using AVD manager as a GUI.

Upvotes: 0

Views: 340

Answers (1)

Martin Zeitler
Martin Zeitler

Reputation: 76689

Somehow run set -ex before running it, for verbose output. Once wrote a script which wraps the emulator. The name of the AVD generally is enough to run it; that's the script I use for running tests:

#!/bin/bash
# it starts the Nexus 7 emulator.
# export ANDROID_SERIAL=emulator-5554
PROJECT=/some/project
AVD=Nexus_7_API_22

/home/google/android-sdk/emulator/emulator \
 -avd $AVD \
 -gpu host \
 -use-system-libs \
 -no-boot-anim \
 -verbose &
EMULATOR_PID=$!

adb wait-for-device

# wait for Android to finish booting
A=$(adb shell getprop sys.boot_completed | tr -d '\r')
while [ "$A" != "1" ]; do
    sleep 2
    A=$(adb shell getprop sys.boot_completed | tr -d '\r')
done
printf "emulator: boot completed."

# unlock the Lock Screen
# adb shell input keyevent 82

sleep 10

cd $PROJECT

# clear and capture logcat
adb logcat -c
adb logcat > ./results/logcat.log &
LOGCAT_PID=$!

# run connected tests
./gradlew mobile:connectedDebugAndroidTest -i

# stop the background processes
kill $LOGCAT_PID
kill $EMULATOR_PID

Upvotes: 1

Related Questions