Android Studio - how to use my wifi in order to connect to internet

2020-03-27 android wifi emulation

I searched on how to get an Internet connection from my emulator in Android Studio and it was suggested I start up the emulator from the command line as follows: emulator -avd Pixel_3a_XL_API_29 -dns-server 8.8.8.8. This indeed has provided an Internet connection when I do from the command line, after adb shell, then run-as com.example.myapplication, then ping abcnews.go.com. this returns packets from the server "...r.cloudfront.net". Looking up this server, it appears to be for Amazon AWS, and is "free", up to some data limit I haven't looked up yet. This is OK short-term, but I would prefer to use my home wifi rather than go thru a different server. What's the best way to have my Android Studio emulator be able to connect to the Internet via my home wifi? (do I need a plugin?) TIA, Steve

Answers

First of all, emulator below API 25 doesn't support wifi.

Second, you can't connect the emulator directly to your WiFi.

The WiFi in the emulator provides a virtual hotspot to which the emulator automatically connects.

So, best practice would be that you connect your PC to your home WiFi and then run the emulator on your PC.

Related