How to allow Android Studio to connect to internet

2019-06-03 21:12发布

问题:

I've Windows Firewall with Inbound and Outbound rules enabled. In android studio, I'm getting "Connection to the internet denied" error while gradle syncing etc. Already allowed studio.exe to connect in firewall but it's not working. If I disable firewall, it's able to connect. So in order to allow android studio to connect to internet without disabling windows firewall, what program should I add to windows firewall rules?

回答1:

Fixed it by adding java.exe to Windows firewall inbound and outbound rules(in my case C:\Program Files\Java\jdk1.8.0_112\bin\java.exe) and also studio.exe ( C:\Program Files\Android\Android Studio\bin\studio.exe) to the rules. Then I was able to sync without disabling windows firewall. Hope it helps somebody..



回答2:

If you are trying to connect to internet through a company firewall, then you need to edit your gradle.properties file

systemProp.http.proxyHost=XX.XX.XX.XX systemProp.https.proxyPort=xxxx