πŸ€– How to fix an android emulator which does not connect to internet?

Why?

Sometimes, the Android emulator does not connect to internet, this might happen if there is a custom DNS server on the network.
This has become a classical emulator issue, but there is no simple way to quickly fix it other than using the emulator’s UI to set static local IP address along with a new DNS inside the network settings.

How?

A quick fix is to run the emulator with a custom DNS using command line. This might not be the best long-term fix, but it might come handy in some situations.

# Get a list of android emulators on your device
emulator -list-avds

# Run an emulator with DNS set to 8.8.8.8 (Google)
emulator -avd Pixel_2_API_30 -dns-server 8.8.8.8

This will open the emulator with DNS already set to “8.8.8.8”.

Advertisement

Published by

Ali Kabiri

Helping friends bring great ideas to reality

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s