For me, I saw the same behavior but the reason was very different than the accepted solution. I'll leave my answer here in case it helps someone else.
TL;DR: Make sure your emulator/device has the correct time!
The Problem
If you're using HTTPS, the device and server time need to be in sync or it will not allow a connection.
Normally that's not a problem, but my emulator has been resetting its time for some reason. The result is that when I connected in debug mode the time was right and it connected just fine. However, the time was wrong when I switched to release mode and did NOT connect.
The problem was subtle because my build variants use different servers, so my secure connection in debug was cached and still valid even after the time changed and release mode did not work, which made this look like an issue with build configs.
The Solution
You can very easily find out if this is your same issue by
- Checking the time on your device
- Opening the URL in a browser. The browser will likely notice the time-difference issue and alert you about it.
If it is, just go into your device settings, update the time, and it should work!