How to connect my android emulators to internet?
1. Purpose
In this post, I will demonstrate how to resolve the DNS_PROBE_FINISHED_BAD_CONFIG internet connection error when using an Android emulator to access the internet.
2. Environment
- MacOS or Windows
- Android Studio 3.x
- Last Update Date: 2021.8
3. The problem
When we try to access an internet website from inside the Android emulator, we get this result:
However, I can visit this website on my host PC:
Why does this happen? My host PC has an internet connection, but the Android emulator does not!
4. The solution
4.1 Solutions that do not work
I have tried the following solutions, but they did not work for me:
- Start the emulator with the host DNS
- Wipe the emulator’s data and do a cold start
- Add DNS entry to my host PC
None of the above solutions worked for me.
4.2 Working solution
Here is the working solution:
-
Step #1: Turn off your host PC’s Wi-Fi by clicking ‘Turn Wi-Fi Off’.
-
Step #2: Kill your emulator if it’s running, then open Android Studio, go to Tools > AVD Manager, and click the
Cold Boot Now
button, as shown below:
After the cold start, the Wi-Fi status in the emulator should look like this:
- Step #3: Now turn on your host PC’s Wi-Fi again.
- Last Step: Test the internet connection in your emulator.
Now the emulator can access the internet. It works!
5. Summary
In this post, I demonstrated how to resolve the internet connection problem when using Android Studio’s emulators. By following the steps outlined above, you can ensure that your Android emulator can access the internet, even if you initially encounter the DNS_PROBE_FINISHED_BAD_CONFIG error. This solution involves turning off your host PC’s Wi-Fi, performing a cold boot of the emulator, and then re-enabling Wi-Fi to establish a successful connection.
Final Words + More Resources
My intention with this article was to help others who might be considering solving such a problem. So I hope that’s been the case here. If you still have any questions, don’t hesitate to ask me by email: Email me
Here are also the most important links from this article along with some further resources that will help you in this scope:
Oh, and if you found these resources useful, don’t forget to support me by starring the repo on GitHub!