Skip to content

Instantly share code, notes, and snippets.

@shashank-shekhar
Created December 2, 2020 19:25
Show Gist options
  • Save shashank-shekhar/12bdceef787667c7f16df00db5e1dc8b to your computer and use it in GitHub Desktop.
Save shashank-shekhar/12bdceef787667c7f16df00db5e1dc8b to your computer and use it in GitHub Desktop.
Add custom domains to android emulator hosts
#Start emulator in write-only mode
C:\Program Files (x86)\Android\android-sdk\emulator>emulator -avd pixel-3 -writable-system
# Pull the existing hosts file to your local machine:
adb root
adb remount
adb pull /system/etc/hosts c:\temp\hosts
# Edit your hosts file e.g.
10.0.2.2 local.mysite.com
# Push the file back
adb push c:\temp\hosts /system/etc/host
# Restart the server and you are good to go.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment