How to set the Android emulator DNS server from Android Studio

If you are on MacOS or Linux, you could rename the Android Emulator executable to something else (say emulator-binary) and create a script with the actual emulator name (emulator) in its place, that calls the executable with the -dns-server parameter.

Here are the steps required:

  1. Find the path where the Android SDK is located in your system. This answer will help you find it.

  2. cd <your-SDK-path>/emulator.

  3. Rename the original executable: mv emulator emulator-binary.

  4. Finally, create an emulator shell script named emulator with the following contents:

<your-SDK-path>/emulator-binary -dns-server "8.8.8.8,8.8.4.4" $@


Unfortunately, as of 3.0.1, this isn't possible. They removed adding additional arguments for emulators launched from Android Studio. Until they add it back in, starting the emulator from the command line (as you showed) is the only option.

You can track this issue here: https://issuetracker.google.com/issues/37071385