If your Android emulator can't resolve domains or loses internet connection, try this:
# Open this file:
code ~/.android/avd/<your_avd_name>.avd/user-settings.ini
# or
code ~/.config/.android/avd/<your_avd_name>.avd/user-settings.ini
# Add this line:
commandLineOptions=-dns-server 8.8.8.8
Then restart the emulator (preferably with a cold boot).
This forces the AVD to use Google’s DNS, works like a charm when local DNS is messy.
Originally found this tip on Stack Overflow while troubleshooting DNS issues in the Android emulator.
Top comments (0)