So I just installed Android Studio again after a long time and it asked me to configure the proxy, so I did. I tested the connection and it worked.
Then it asked me
This should work:
Go to 'Gradle Scripts'
Then go to 'gradle.properties'.
There you will see proxy settings something like:
systemProp.http.proxyHost=[YOUR PROXY]
systemProp.http.proxyPort=[PORT]
As you may see this is for 'http' only.
Just add the same for 'https':
systemProp.https.proxyHost=[YOUR PROXY]
systemProp.https.proxyPort=[PORT]
Worked for me.