Solution 1 :
I also faced a very similar thing, I will suggest you to change the jet pack dependency to https://www.jitpack.io
Solution 2 :
So it is finally working.
What was the fix?
Well, a bit hard to say. In the past weeks I’ve been having problems with connecting to some sites via wi-fi, a problem I ignored because I would switch to mobile data and get what I needed.
However I started paying attention when the number of non-reachable sites started increasing and when Netflix stopped playing I had to pay attention. 🙂
I remembered I had tinkered with parental controls on my modem and had left it with some configuration to block certain sites.
So I decided to reset the modem to last working configuration and all of my sites started working again.
When I saw this, I remembered this problem and thought I’d try it again – and it works!!!
What still confuses me is why accessing the gradle site from the browser worked with no problem, but I won’t look this gift horse in the mouth. I’ll take it!
Problem :
I just downloaded Android Studio 4.0.1 and tried to build one of the sample projects.
It fails at the very beginning when trying to do a Gradle sync.
It fails to download https://services.gradle.org/distributions/gradle-5.4.1-all.zip
with the error:
Gradle sync failed: Connection timed out: connect. If you are behind an HTTP proxy, please configure the proxy settings either in IDE or Gradle.
Consult IDE log for more details (Help | Show Log) (
What I find really puzzling is that this seems to be an error that has been plaguing people for a very long time, I have found so many questions on this but not a single answer that is helping me.
Just to be clear on what has been tried so far:
-
I have checked the http proxy settings in File->Settings->http settings. It is set to “No proxy” (as expected, I don’t have a proxy).
-
When I test a connection the one above (https://services.gradle.org) fails. Something simple like www.google.com is ok. More interestingly, I tried another https endpoint and that one failed too. So I don’t know if it’s something https specific
-
my gradle.properties file has no proxy settings (as mentioned, I don’t use a proxy)
-
the services.gradle.org endpoint works absolutely fine from my browser and I’m able to download the file. This I find puzzling, they should both be connecting outside via the same wi-fi modem, shouldn’t they?
-
I have tried restarting my machine, no luck
-
Even more interesting, I created an Ubuntu VM, installed Android Studio there and had none of these issues with the gradle sync failing to connect
Does anybody have any idea what is going on or has managed to crack the code on this after all this time?
EDIT
As I was writing the question above I realised it could be my windows firewall blocking this.
Excited, I rushed off to try it out, completely turned the firewall off, restarted the computer – but still nothing. Gradle syncing is failing in Android Studio while downloading the file works perfectly fine from the browser.
Comments
Comment posted by user3769663
Thanks for the suggestion, much appreciated. Unfortunately, I don’t have any jetpack dependencies defined. I’m really just trying to build one of the sample apps available in Android Studio.
Comment posted by user3769663
I’ve tinkered a bit more and still no luck. Might have to move to my Linux VM – the only reason I didn’t want to do this is because running the emulator on my VM does not really work. But Windows has thrown an unexpected blocking issue so it seems I will have to drop it.