How to fix Android Emulator Wi-Fi Connected with No Internet
I have wasted a whole day trying out different solutions floating around in Stack Overflow and other place mentioned to enable Wi-Fi on the android emulator but to no avail.
I am on mac OS Catalina 10.15.5 directly connected through my phone as hot-spot Wi-Fi, the emulator has internet through Wi-Fi, but it fails when I connect my computer to my home router. with no proxy.
I even tried deleting all the AVDs, re-installing, cold boot them. I even tried having installed the latest Pixel 3 with Android R. Nothing seems to be working.
Luckily, I found the solution to fix this.
Android AVDs come with Google DNS configured inside emulators. So we need to set same to network sharing for accessing same.
Windows
- Go to the Control Panel.
- Click Network and Internet > Network and Sharing Center > Change adapter settings.
- Select Properties.
- Select the Networking tab. Under This connection uses the following items, select Internet Protocol Version 4 (TCP/IPv4) and then click Properties.
- Click Advanced and select the DNS tab. If there are any DNS server IP addresses listed there, write them down for future reference, and remove them from this window.
- Click OK.
- Select Preferred DNS server and Alternate DNS server.
- Preferred DNS Server: 8.8.8.8
- Alternate DNS server: 8.8.4.4
- Click OK.
- Restart AVDs.
macOS
DNS settings are specified in the Network window.
- Click Apple menu > System Preferences > Network.
- Click Advanced.
- Select the DNS tab.
- Add 8.8.8.8 and 8.8.4.4
- Click OK > Apply.
- Restart AVDs.
Reference: