Android Studio - how to use my wifi in order to connect to internet2020-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 126.96.36.199. 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
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.
- Android Studio - Android Emulator Wifi Connected with No Internet
- Android Studio: Add jar as library?
- How to get screen dimensions as pixels in Android
- How do I "select Android SDK" in Android Studio?
- How to stop EditText from gaining focus at Activity startup in Android
- How to lazy load images in ListView in Android
- Error "The connection to adb is down, and a severe error has occurred."