Skip to content

Instantly share code, notes, and snippets.

@glowinthedark
Last active October 14, 2024 06:53
Show Gist options
  • Save glowinthedark/242859e5e68a6e7dd0a5e7cc95805418 to your computer and use it in GitHub Desktop.
Save glowinthedark/242859e5e68a6e7dd0a5e7cc95805418 to your computer and use it in GitHub Desktop.
run android emulator on macos
#!/usr/bin/osascript -l JavaScript
// THE SHEBANG IS ONLY NEEDED IF YOU RUN IT AS A SHELL SCRIPT
// ^^^ REMOVE THE SHEBANG LINE ABOVE IF RUNNING FROM SCRIPT EDITOR/AUTOMATOR!!!!! ^^^
// 1. In MacOS Spotlight type 'Script Editor' and paste the code below
// 2. Click the top-left dropdown which says 'AppleScript' and select 'JavaScript'
// 3. Under menu File pick Export
// 4. In the Export dialog select File Format = Application
// 5. Save the app in /Applications
var app = Application.currentApplication()
app.includeStandardAdditions = true
var avds = app.doShellScript("~/Library/Android/sdk/emulator/emulator -list-avds");
var avdList = avds.split("\n").filter(function(line) { return line.trim() !== ""; });
var selectedAVD = app.chooseFromList(avdList, {
withPrompt: "Please select an AVD to start",
defaultItems: [avdList[0]]
});
app.doShellScript("~/Library/Android/sdk/emulator/emulator -avd " + selectedAVD + " -no-boot-anim > /dev/null 2>&1 &");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment