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
On your Mac open your terminal window and hit below command
echo $proxy
It should return your IP address and port number
Now check your gradle.properties of your project and seyt below properties as per your login details
systemProp.http.proxyPort=80
systemProp.http.proxyUser=
org.gradle.parallel=true
systemProp.http.proxyPassword=
org.gradle.jvmargs=-Xmx1536m
systemProp.https.proxyHost=
systemProp.http.proxyHost=
systemProp.https.proxyPort=