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
I solved my problem by putting the proxy options with http and https. Before it was just http and was giving error, after I added https, it worked.
http
https