Skip to content

Instantly share code, notes, and snippets.

@nisrulz
Last active August 24, 2021 14:06
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 nisrulz/59d6da0a107ea0c44f4a55db6e00d9c0 to your computer and use it in GitHub Desktop.
Save nisrulz/59d6da0a107ea0c44f4a55db6e00d9c0 to your computer and use it in GitHub Desktop.
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