Skip to content

Compatibility with Android Studio 2023.2.1 Canary 15 #6

@Uj947nXmRqV2nRaWshKtHzTvckUUpD

Description

Since several versions now (don't know which), on canary Android Studio, the avd.sh script is not working anymore because of an extra INFO line shown by emulator command.

i adapted the script to fix it:

#!/usr/bin/sh

# don't show pushd stack
pushd () {
    command pushd "$@" > /dev/null
}

pushd ${ANDROID_HOME}/emulator
emuAvds=$(./emulator -list-avds)
# echo "emuAvds: ${emuAvds}" # DEBUG


echo "Emulator Android Virtual Devices:"
avds=$(echo "${emuAvds}" | grep -v ^INFO | cat -n)
echo "${avds}"

ignoredINFO_lines=$(echo ${emuAvds} | grep ^INFO | wc -l)
# echo "number of beginning INFO lines ignored: ${ignoredINFO_lines}"
# eg. INFO line: 
# INFO    | Storing crashdata in: C:\Users\<user>\AppData\Local\Temp\\AndroidEmulator\emu-crash-34.1.12.db, detection is enabled for process: 8548

printf "Select AVD to start: "
read index
#echo "index: ${index}" # DEBUG

emuAvdsIndex=$((${index} + ${ignoredINFO_lines}))
#echo "emuAvdsIndex: ${emuAvdsIndex}" # DEBUG


avd=$(echo "${emuAvds}" | sed "${emuAvdsIndex}q;d")
echo "Selected ${emuAvdsIndex}: ${avd}"
./emulator -netdelay none -netspeed full -avd "${avd}"
popd

# REF: https://github.com/enieber/open-avd/blob/master/avd.sh

I tested it in git bash in windows on android studio canary.
Would be good to test on current stable android studio emulator before releasing.

Cheers

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions