If it is NOT 8.8.8.8, follow this to fix.
If it wasn't already checked, restart the emulator before proceeding Step 2 However, on the latest versions, it works better to keep this checked. I emphasis this because many of the previous solutions said to uncheck this. Click on Proxy at the top and make sure Use Android Studio Http proxy settings IS CHECKED.
The following steps are for an emulator running Android 11.
You have to change the DNS settings within the Emulator. It no longer works to just change the DNS Servers on your local PC. The problem is the DNS settings on the Emulator.
It seems the previous answers to this problem no longer work in 2021 (Using Android Studio 4.1.2).