Reputation: 6177
I just create a new Project in the android studio and add gcm module to it.
and I keep giving this error message
Error:Connection timed out: connect. If you are behind an HTTP proxy, please configure the proxy settings either in IDE or Gradle.
and I do not use any proxy.
can anyone help me about this?
Update
now after rebuild my project i give this error
Error:A problem occurred configuring project ':app'.
A problem occurred configuring project ':backend'.
Could not resolve all dependencies for configuration ':backend:classpath'.
Could not resolve com.google.appengine:gradle-appengine-plugin:1.9.18.
Required by:
PushStart:backend:unspecified
Could not resolve com.google.appengine:gradle-appengine-plugin:1.9.18.
Could not get resource 'https://jcenter.bintray.com/com/google/appengine/gradle-appengine-plugin/1.9.18/gradle-appengine-plugin-1.9.18.pom'.
Could not GET 'https://jcenter.bintray.com/com/google/appengine/gradle-appengine-plugin/1.9.18/gradle-appengine-plugin-1.9.18.pom'.
Connection to https://jcenter.bintray.com refused
Upvotes: 5
Views: 43161
Reputation: 13
one solution for this problem go to the proxy settings, File > setting > Appearance & Behavior >System Settings > HTTP Proxy or by clicking ctrl+alt+s. And set no proxy if you not use proxy or set Auto-detect proxy settings.
if it is not work fine.
you can this way go to Gradle Scripts in your project and inside that you have file with name gradle.properties(Global Properties). not go to the gradle.properties(Project Properties) file. bottom of that file you can see some proxy settings. if you not use the connection with proxy you can remove that part. if you use the proxy you should check that correct or not. ////////////////////////////////////////////////////////
file location in my way C:\Users\HP.gradle\gradle.properties
////////////////////////////////////////////////////////
systemProp.http.proxyHost=192.168.0.10
systemProp.http.proxyPort=3128
systemProp.https.proxyHost=192.168.0.10
systemProp.https.proxyPort=3128
/////////////////////////////////////////////////////////
if you use proxy keep it like this with your proxy settings
## For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
#
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx1024m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
#
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
#Wed Mar 17 08:43:50 IST 2021
systemProp.http.proxyHost=192.168.0.10
systemProp.http.proxyPort=3128
systemProp.https.proxyHost=192.168.0.10
systemProp.https.proxyPort=3128
if you not use proxy keep it like this
## For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
#
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx1024m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
#
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
#Wed Mar 17 08:43:50 IST 2021
Upvotes: 1
Reputation: 21
I solved the issue by
file -> settings -> search for proxy -> changed from noProxy to use proxy and provided company given proxy
Upvotes: 1
Reputation: 3159
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.
Upvotes: 0
Reputation: 396
Just try Invalidate Caches.. Goto File->Invalidate Caches/Restart->Choose "Invalidate and Restart".
Upvotes: 7
Reputation: 2375
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
Upvotes: 3
Reputation: 21
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!!
Upvotes: 2
Reputation: 544
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
Upvotes: 6