Libgdx Android Studio proxy issue - android

Recently I started learning the libgdx library and wanted to give it a try on Android Studio.
I followed up some tutorials found on different websites. The problem is when gradle sync starts, it gives an 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.
I m not behind any proxy. I tried to disable firewall, enable offline / online gradle sync with the offline folder, forced the sdk to download with http instead of https, changed the distributionUrl into http and changed the distribution url aswell.
Nothing worked.
I don't really know if it is a coincidence or not but when I try to launch the standalone SDK, it gives this error when trying to fetch url saved in the SDK update sites:
Failed to fetch URL https://dl.google.com/android/repository/repository-11.xml, reason: HttpHostConnect Connection to https://dl.google.com refused
Thank you.

Try to do that:
Android SDK Manager > Tools > Options
Check "Force https://...
sources to be fetched using http://..."

Related

Proxy blocks file - manual download works. Gradle still not working

I'm simply trying to install android studio. Unfortunately my gradle isn't working properly.
The configure build is always failing and throws the error:
Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom'. Received status code 407'
I can download the file manually without any problem. (but don't know where to put it so android studio will find it)
I even restarted android studio several times, downloaded gradle locally and put the http proxy on auto detect proxy settings.
The HTTP status code 407 indicates that a proxy authentication is required. Have a look at the documentation on how to do proxy authentication for Gradle as the details really depend on the expected proxy authentication scheme.

Gradle sync failed: Could not connect to server

In my android studio 3.0 i am continuously getting this error -
Cannot start internal HTTP server. Git integration, JavaScript debugger and LiveEdit may operate with errors. Please check your firewall settings and restart Android Studio.
after this my gradle sync also failed stating the error -
Gradle sync failed: Could not connect to server [a3ea2c7d-cc16-4af2-82a9-037277903c02 port:49555, addresses:[/127.0.0.1]]. Tried addresses: [/127.0.0.1].
One thing to note down that this gradle sync failed when it(gradle) is connecting to gradle daemon.
i have tried all the options from stack overflow like netsh winsock reset etc.
But nothing work for me.
Also to mention i do not use embedded JDK in AS. I have provided it my downloaded jdk8.
How to solve this problem.
Thanks in advance.
Make sure your machine is connected to the internet.
Check the link here: Configure Android Studio - Proxy
I personally recommend that you try disabling the proxy if it is enabled.
Go to Windows Firewall -> Inbound & Outbound Rules -> add java.exe from JDK path & studio.exe from Android Studio directory.

Cannot sync with gradle behind proxy, site is not blocked, opens from browser

I am trying to open a project (developed in a different machine) with my newly installed android studio 2.3. The studio was downloading gradle-2.1.2.pom but threw the following error:
Could not GET
'https://jcenter.bintray.com/com/android/tools/build/gradle/2.1.2/gradle-2.1.2.pom'.
Received status code 403 from server: Forbidden
When I try to open the same url above from my browser, it downloads the .pom file, which means the proxy is not blocking it. I have configured the studio with the proxy address and login credentials. Can anyone explain me why is android studio unable to connect to the same site that the browser can open.
Note: I could not find any hint about this in the existing questions about gradle behind proxy, so this new question.
I found out the answer. The solution is to add the certificate to the site https://jcenter.bintray.com in Java (follow this link to do so) and restart the android studio. Basically, the site has to be trusted by java runtime for connecting using https.

Gradle Sync Connection Timeout

I often get the following error while trying to sync gradle
Error:Connection timed out: connect. If you are behind an HTTP proxy, please configure the proxy settings either in ide or gradle.
Sometimes that i don't get the error, gradle sync takes more than 1 hour
Try to open and check this url in your browser
Google DL and try downloading latest Gradle version from Gradle Site
If you aren't able to access and download the files the time consumption is because you might be getting 403. You might not be having download access on your machine.
Contact your network administrator and ask for access.
Configure your gradle.properties with below settings -
systemProp.http.proxyPassword=
systemProp.http.proxyHost=
systemProp.http.proxyPort=
systemProp.http.proxyUser=
systemProp.https.proxyPort=
systemProp.https.proxyUser=
systemProp.https.proxyHost=
systemProp.https.proxyPassword=
Or you can go to Settings -> HTTP Proxy -> Provide details.
Now go to SDK Manager -> Tools -> Options -> Set provided proxy server and port.
Rebuild your project, you would be prompted with proxy dialog -> Check https proxy and build.
EDIT 1
If above solution does not work. Go to settings -> Search Gradle -> Check offline mode under Global gradle settings.
I Just encounter the same issue in my office network.
By default the "HTTP Proxy" is set to "No Proxy" in Android Studio.
I fix this the problem by making "HTTP Proxy" to "Auto Detect".
If it was working fine earlier and stopped all of a sudden, try removing any recent dependency that you have added and sync again. If you can't recall then try running it in offline mode.

Android Studio Failed to fetch - Connection refused: connect

Android Studio Setup Wizard (studio64.exe) is not able to fetch some XMLs.
I have set in studio64.exe.vmoptions
-Djava.net.preferIPv4Stack=true
-Dhttp.proxyHost=...
-Dhttp.proxyPort=...
Also tried
-Dhttp.proxyHost=www.google.com
-Dhttp.proxyPort=80
But nothing works and I didn't find anything helpful on google seeming like I'm the only one with that problem.
Details:
Android SDK was installed to C:\Users\*\AppData\Local\Android\sdk
Refresh Sources:
Failed to fetch URL http://dl-ssl.google.com/android/repository/addons_list-2.xml, reason: Connection refused: connect
Fetched Add-ons List successfully
Refresh Sources
Failed to fetch URL http://dl-ssl.google.com/android/repository/repository-10.xml, reason: Connect Connection refused: connect
Refresh Sources:
Failed to fetch URL http://dl-ssl.google.com/android/repository/repository-10.xml, reason: Connect Connection refused: connect
There is nothing to install or update.
The following SDK component was not installed: build-tools-21.1.1
I'm using a lot of dev tools without a problem and Android Studio is now the first one with connectivity issues.
The XML files mentioned I can access via browser without a problem.
I had a similar issue when working behind a proxy server on x86 system. Initially the Studio doesn't provide any interface for settings so the following has to be done.
Proxy settings for Android Studio should be made in "other.xml" which resides in "D:\Users\%UserProfile%.AndroidStudio\config\options" (in my system).
To manually set a proxy find "USE_HTTP_PROXY" and make it's value = "true" followed by proper "PROXY_HOST" and "PROXY_PORT" values.
To automatically detect the present proxy settings find "USE_PROXY_PAC" and make it's value = "true".
If you are on Windows, try running Android Studio as Administrator. It solved the problem for me. I am using Android Studio 1.5.1.
EDIT: The problem came up again and this time, it was solved by setting the HTTPS Proxy as well in addition to HTTP Proxy. More details here.

Categories

Resources