android studio error Error:Connection timed out

一曲冷凌霜 提交于 2019-11-29 11:13:46
Nike15

The answer from this SO post might help you.

You should add the below lines in the gradle.properties file for the https setings configuration

    systemProp.https.proxyHost=www.somehost.org
    systemProp.https.proxyPort=8080
    systemProp.https.proxyUser=userid
    systemProp.https.proxyPassword=password
    systemProp.https.nonProxyHosts=*.nonproxyrepos.com|localhost

Just try Invalidate Caches.. Goto File->Invalidate Caches/Restart->Choose "Invalidate and Restart".

kokabi

If you encounter these errors even without proxy or if you have downloaded a source code and unable to compile it, follow these steps:

1- Create another empty project

2- Go to File\Project Structure\project and take note Gradle Version and Android Plugin Version

3- go back to the Troubled project and use same Versions in previous path. sometimes needed to change both jcenter to mavenCentral too

4- in the Project Structure Window go app\properties and change Compile Sdk Version to Latest Version.

5- I recommend change the Target Sdk Version to latest version too (in the Flavors tab)

6- Sync, Clean and Rebuild project.

Now, the problem with gradle compiler is resolved, You may encounter with some errors about dependencies. These problems usually resolve with updating dependencies. for update dependencies to latest version use this guide provided by @Jared Kells

If you are on Win7, then your Firewall blocks Android studio from connecting. You will have to add android studio to the trusted files and bingo! everything will start working!!

if you are behind proxy and your proxy is not configured in android studio, you should do below link: Error:Connection timed out: connect

and if you are configured your proxy setting or your issue is not related to proxy, you have to update your sdk handily by below path: tools>android>sdk manager>sdk tools> check any thing you need and click on OK, then your sdk become update and then click on syncrow or Try Again button.

I solved the issue by

file -> settings -> search for proxy -> changed from noProxy to use proxy and provided company given proxy

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!