Enabling Internet in Android Emulator

 This experiment is run on a Mac Laptop. For Windows, the file path may be different but the commands should be essentially the same.

1. cd to the location: `~/Library/Android/sdk/emulator`

Now view the list of available emulators with: `./emulator -list-avds`

Say you want to enable internet in the first device Nexus_5_API_30, 

make sure the emulator isn't running(it's closed), then run the following command:

`./emulator -avd Nexus_5_API_30 -dns-server -read-only`

Now the emulator starts and you can browse internet in it. 

Most importantly you can now sign in to Google Play store and perform various operations, like in my case I needed to pair a phone emulator to a watch emulator which needed Wear OS app to be installed on the phone and that needed Google Play Store login.

Let me know if this works for you or not.


Popular posts from this blog

ADB Cheat Sheet

Capturing Screen of Android Device using ADB

Debugging Android app with ADB command