No internet on Android emulator
On macOS 10.15.5, I start the Android emulator from the command line.
% emulator -avd Pixel_XL_API_30
I found that the emulator cannot access the network, but my computer can. And it can be accessed by IP address. Use
adb shell to enter the emulator system and run the
ping command to test the internat.
% adb shell generic_x86_arm:/ $ ping www.google.com generic_x86_arm:/ $ ping 192.168.8.1
simulator command, add the
-dns-server option, which the emulated system will use this DNS server(s).
% emulator -avd Pixel_XL_API_30 -dns-server 126.96.36.199,188.8.131.52