Android Emulator On Macos

  

Script to setup and start a standalone Android Emulator on a macOS machine.
Readme.md
Open multiple android emulator on mac os

In this post I am going to share the installation and configuration of the Android Studio software for emulation of Android devices. Check out my colleague John Guy’s blog for instructions on how to setup an Android Emulator for MacOS: Setting up an Android Emulator for testing Intune features on Apple macOS – Azure Cloud & AI Blog. There are many Android emulators are in the market but not all of them are good. I have researched and made a list of Best Android Emulator.

setup_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
Emulator
start_android_emu.sh
#!/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 freeto join this conversation on GitHub. Already have an account? Sign in to comment

How to use Android Debug Bridge (adb) on Android Emulators?

This mini-blog will guide you on how to use the Android Debug Bridge (adb) command to perform complicated tasks under seconds.

1. What's Android Debug Bridge (adb)?

Android Debug Bridge is a powerful debugging tool that allows Android Developers to communicate with Android Emulators and executes many commands.

It facilitates how developers do many complicated and error-prone tasks, such as:

  • Override / Revert HTTP Proxy
  • Turn On/Off Wifi Network
  • Install and Trust
  • Close all running application
  • and more...

It enables developers to can perform many tasks by command line and save more time to focus on the UI/UX of the app.

You can read more at: https://developer.android.com/studio/command-line/adb

2. Installation

If you haven't installed the adb command yet, you can manually install by following the guideline:

1/ Install homebrew

2/ Install the adb command

Read more at: https://stackoverflow.com/questions/31374085/installing-adb-on-macos

Android Emulator Macos Big Sur

3. Common Tasks

All the following tasks requires the rooted Android Emulator.

Root Android Emulators

Please make sure that your Android Emulator is Google APIs version, not Play Store version.

  1. Open the Android Emulator from Android Studio
  2. Run
  1. Wait couple minutes for restarting the devices.

Override HTTP Proxy

  • Override HTTP Proxy from Android Emulator to IP 127.0.0.1 at port 9090

Revert HTTP Proxy

  • Since the HTTP Proxy config is overridden by the command line, it's crucial to revert it back when you don't need it anymore. Otherwise, your Android Emulator might not be able to access the Internet.

Install and Trust Self-signed certificates

  • Install and trust self-signed certificates on Android Emulator is painful, especially if you're using Android 11+, which requires extra steps to trust the certificate in the system.

You can automatically achieve it by using the following commmands:

You can verify whether or not the certificate is installed and trusted properly by navigating to:

  • Setting app -> Security -> Encryption & Credentials -> Trusted Certificate -> User Tab

Enable Wifi Network

Close all running applications

  • Prepare the script: closeall.sh
  • Execute the script

4. ADB with Proxyman

From Proxyman 2.10.0+, Proxyman introduces Automatic Script for Android Emulator, which performs complicated tasks with one-click.

Android Emulator On Macos Operating System

Macos

It includes:

  • Override HTTP Proxy to Proxyman
  • Revert HTTP Proxy if need
  • Auto Download, Install, and Trust Proxyman CA Certificate to your Android Emulator.
Best free android emulator

Open Multiple Android Emulator On Mac Os

You can access via Certificate Menu -> Install Certificate on Android -> Emulator

Read more at: https://docs.proxyman.io/debug-devices/android-device/automatic-script-for-android-emulator

Proxyman is a high-performance macOS app, which enables developers to view HTTP/HTTPS requests from apps and domains on macOS, iOS device, iOS Simulator and Android devices and emulators.

Get it at https://proxyman.io