Skip to content

Instantly share code, notes, and snippets.

@nisrulz
Last active Aug 24, 2021
Embed
What would you like to do?
Script to setup and start a standalone Android Emulator on a macOS machine.

Standalone Android Emulator on a macOS

Script to setup and start a standalone Android Emulator on a macOS machine.

Setup

./setup_android_emu.sh

Start

./start_android_emu.sh
#!/usr/bin/env bash
###############################################################################
# Script to setup a standalone Android Emulator on a macOS machine.
###############################################################################
echo "Installing tools and dependencies..."
touch ~/.android/repositories.cfg
brew install --cask homebrew/cask-versions/adoptopenjdk8 android-sdk intel-haxm
echo "Creating Emulator..."
export ANDROID_SDK_ROOT="/usr/local/share/android-sdk"
# Make sure your JDK version set in the terminal is 1.8
# If you have multiple JDK setup, read about how to switch JDK here: https://gist.github.com/nisrulz/e90bddac3dbd2f6b8d4adc7b150c07e9
sdkmanager "platform-tools" "platforms;android-27" "extras;intel;Hardware_Accelerated_Execution_Manager" "build-tools;27.0.0" "system-images;android-27;google_apis;x86" "emulator"
avdmanager create avd -n test -k "system-images;android-27;google_apis;x86" --tag google_apis
#!/usr/bin/env bash
###############################################################################
# Script to start a standalone Android Emulator on a macOS machine.
###############################################################################
echo "Starting Emulator..."
# Once emulator is created, simply use this one liner to start it.
# No need to create it again.
#
# NOTE: if you Android Studio installed your path to emulator might look like: /Users/your_user_name/Library/Android/sdk/emulator/emulator
/usr/local/share/android-sdk/emulator/emulator -avd test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment