Skip to content

Instantly share code, notes, and snippets.

@guavabot
Created November 18, 2016 16:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guavabot/1474739af75a643732ba7fd0b29b066b to your computer and use it in GitHub Desktop.
Save guavabot/1474739af75a643732ba7fd0b29b066b to your computer and use it in GitHub Desktop.
Select an emulator and add local IP as http proxy
#!/bin/bash
emulator () {
EMULATORS=$(~/Library/Android/sdk/tools/emulator -list-avds)
LOCAL_PROXY_IP=`ipconfig getifaddr en0`
echo "Enter the number of the emulator you want to launch:"
PS3="Your choice: "
select EMULATOR in $EMULATORS;
do
if [ ! -z "$EMULATOR" ]; then
~/Library/Android/sdk/tools/emulator -avd $EMULATOR -http-proxy http://${LOCAL_PROXY_IP}:8888 & disown;
else
echo "Emulator $REPLY is not in the family of emulators!"
fi
break
done
}
emulator
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment