Whenever I create a new project in Android Studio it fails at Gradle Sync and always the same error:
Connection timed out: connect
org.gradle.internal.resource.transport.http.HttpRequestException: Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.1.4/gradle-3.1.4.pom'.
A screenshot of the IDE
:
It fails exactly when GET
this link: https://jcenter.binary.com/com/android/tools/build/gradle/3.1.4/gradle-3.1.4.pom
, but it can receive other links like dl.google.com and SDK Manager.
I was getting this error even on AS 3.1.3
and I haven't ever been able to create an Android Application
by Android Studio
. It can be done easily by Eclipse ADT
, but I wanna use Android Studio
because it's the official IDE
for Android
and Google is supporting Android Studio
.
Any way to solve this boring failure of Gradle
?
(I already searched one thousand times at Google
and Stack overflow
)
Finally it worked!
JCenter
detects most VPNs, I have a better solution for you (Iranian developers):
There is a service that helps us to pass restrictions (like JCenter
, Android Developer
, and so many services): https://shecan.ir (شکن), you can use that fast service without disconnection or other headaches (it uses DNS
to bypass restrictions, so usually faster than VPN).
Dear Iranian Developers, you can easily solve this problem with these simple steps:
1 - Turn on the Psiphon
2 - In the Psiphon
(VPN) go to Settings -> Local Proxy Ports -> HTTP, HTTPS: 63620
- SOCKS: 63621
. This will force the Psiphon
to always use port 63620
for HTTP.
3- Go to AS
Settings -> Appearance & Behavior -> System Settings -> HTTP Proxy -> Manual proxy configuration -> HTTP: Host name: 127.0.0.1
- Port: 63620
-> Uncheck Proxy Authentication
.
Note: These ports (63620
, 63621
) are custom, but the HTTP port of the Psiphon
and the AS
HTTP Proxy Settings must be the same.
4 - Note: Android Studio
works online only the first time you create the project. After that, you can work offline and build your project or sync it again with Gradle
.
Done!