Table of contents

No internet on Android emulator

Android Sep 14, 2021 Viewed 145 Comments 0

Issue

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

Solution

With the 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 8.8.8.8,114.114.114.114
Updated Sep 14, 2021