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
In your gradle.properties file inside your app project, add the following properties (both HTTP and HTTPS):
systemProp.http.proxyHost=
systemProp.http.proxyPort=
systemProp.https.proxyHost=
systemProp.https.proxyPort=
If your network has a proxy (not defined in your system configuration), go to:
File > Settings > Appearance & Behavior > System Settings > HTTP Proxy
and setup Manual proxy configuration,
otherwise, check Auto-detect proxy settings.