In this post, I would demo how to solve the DNS_PROBE_FINISHED_BAD_CONFIG internet connection failed/error problem when using android emulator to access the Internet.
- MacOS or Windows
- Android Studio 3.x
- Last Update Date: 2021.8
3. The problem
When we try to access Internet website from inside the android emulator, we get this result:
But I can visit this website on my host pc:
Why did this happen? My host pc does have internet connection ,but the android emulator does not!!!
4. The solution
4.1 Solutions that not working
I have tried the following solutions ,but they are
not working for me:
- Start the emulator with the host dns
➜ emulator ./emulator -list-avds Pixel_XL_API_30_android_11 ➜ emulator ./emulator @Pixel_XL_API_30_android_11 -dns-server 220.127.116.11 [38984:135683:0825/155411.068921:ERROR:ssl_client_socket_impl.cc(1050)] handshake failed; returned -1, SSL error code 1, net_error -100 ^Cemulator: Saving state on exit with session uptime 194883 ms ➜ emulator
- wipe the emulator’s data and do a cool start
- Add dns entry to my host pc
All the above solutions do not work for me.
4.2 Working solution
Here is the working solution.
Step #1: Turn off your host PC’s wifi, just click ‘turn wi-fi off’
Step #2: Kill you emulator if it’s running, then open your android studio, goto Tools–AVD Manager , click
Cold Boot Nowbutton,just as follows
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!
In this post, I demonstrated how to fix the internet-connection-problem when using android studio’s emulators.