Skip to content

Instantly share code, notes, and snippets.

@inomdzhon
Last active July 29, 2021 13: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 inomdzhon/ee898d25b8c17bd2d1cfbb6f7e03a901 to your computer and use it in GitHub Desktop.
Save inomdzhon/ee898d25b8c17bd2d1cfbb6f7e03a901 to your computer and use it in GitHub Desktop.

Android Studio emulator (Mac OS)

emulator-commandline documentation

For first download Android Studio.

Quick start

For start emulator

sudo ~/Library/Android/sdk/emulator/emulator -avd <your_avd_name> -writable-system -netdelay none -netspeed full

For find <your_avd_name> type

sudo ~/Library/Android/sdk/emulator/emulator -list-avds

Change /etc/hosts

cd ~/Library/Android/sdk/platform-tools
./adb root
./adb remount
./adb pull /system/etc/hosts hosts
vim hosts

Example

127.0.0.1       localhost
::1             ip6-localhost
10.0.2.2 example.com

Change hosts file. We need to use the IP address where our local server is running. Finally we need to update this file on the Android system

./adb push hosts /etc/hosts
./adb push hosts /etc/system/hosts
./adb push hosts /system/etc/hosts

Add certificates

Push your certificates to device (also you can drag and drop them, they will dropped in same folder)

> ./adb push <root_cert_path> /sdcard/Download
> ./adb push <local_cert_path> /sdcard/Download

For me <root_cert_path> is

./adb push ~/Library/Application\ Support/mkcert/rootCA.pem /sdcard/Download

And <local_cert_path> is

./adb push ~/cert/local.stage307.tech+7.pem /sdcard/Download

Then open Android Settings and type to seach field Advanced Wi-Fi and go to. Next tap to Install certificates and install them (type any name in dialog).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment