# Http(s) proxy problem

**URL:** <https://discuss.gradle.org/t/http-s-proxy-problem/23427>\
**Category:** Help/Discuss\
**Created:** [July 24, 2017, 2:59pm UTC](https://discuss.gradle.org/t/http-s-proxy-problem/23427 "2017-07-24T14:59:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hbkoenig](https://avatars.discourse-cdn.com/v4/letter/h/b77776/32.png) [@hbkoenig](https://discuss.gradle.org/u/hbkoenig)\
**Post date:** [July 24, 2017, 2:59pm UTC](https://discuss.gradle.org/t/http-s-proxy-problem/23427/1 "2017-07-24T14:59:30Z")

</div>

Hi Gradle Team,

I’m trying to setup an AndroidStudio build setup for jenkins, running on Ubuntu 16.04 behind a company firewall.

both gradlew (v. 3.3) and gradle binary zips (v. 3.3 and 4.1-rc1) all finally fail with this error messages for a minmal project in for traget “clean”:

java.net.UnknownHostException: [dl.google.com](http://dl.google.com)  
Failed to connect to host: [https://dl.google.com/android/repository/addons\_list-3.xml](https://dl.google.com/android/repository/addons_list-3.xml)  
Failed to connect to host: [https://dl.google.com/android/repository/addons\_list-2.xml](https://dl.google.com/android/repository/addons_list-2.xml)  
Failed to connect to host: [https://dl.google.com/android/repository/addons\_list-1.xml](https://dl.google.com/android/repository/addons_list-1.xml)  
Failed to download any source lists!

FAILURE: Build failed with an exception.

I’ve set lots of different sources to tell gradle the https proxy:

for 1st start of gradle these settings in ~/.gradle/gradle.properties are sufficient:

systemProp.https.proxyHost=localhost  
systemProp.https.proxyPort=3128

but this does not hold for the “addons\_list-\*.xml” files above.

in the mean time I’ve send HTTPS\_PROXY and https\_proxy env variables,  
as well as

https.proxyHost=localhost  
https.proxyPort=3128

in both gradle.properties and java …/jre/lib/net.properties

I’ve tried both (default)

# java -version

openjdk version "1.8.0\_131"  
OpenJDK Runtime Environment (build 1.8.0\_131-8u131-b11-0ubuntu1.16.04.2-b11)  
OpenJDK 64-Bit Server VM (build 25.131-b11, mixed mode)

and

# java -version

java version "1.8.0\_141"  
Java™ SE Runtime Environment (build 1.8.0\_141-b15)  
Java HotSpot™ 64-Bit Server VM (build 25.141-b15, mixed mode)

without success:-(

how do I have to specity the internet proxy for downloading those “addons\_list-\*.xml” files ???

thanks,

Harald

---

<div class="post-metadata">

**Author:** ![hbkoenig](https://avatars.discourse-cdn.com/v4/letter/h/b77776/32.png) [@hbkoenig](https://discuss.gradle.org/u/hbkoenig)\
**Post date:** [July 25, 2017, 4:53pm UTC](https://discuss.gradle.org/t/http-s-proxy-problem/23427/2 "2017-07-25T16:53:36Z")

</div>

update:

running “gradle --offline” showed a new error message

```
FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> Failed to find target with hash string 'android-17' in: /opt/android-sdk-26

```

which pointed to some install issue with sdk-26 because

```
# ./sdkmanager --uninstall platforms\;android-17
Warning: Unable to find package platforms;android-17
done

```

so I’ve scratched and reinstalled sdk-26 and now – drum roll – gradle works fine and builds the sample project apk!!

still, without “–offline” I get those warnings

```
Warning: Failed to connect to host: https://dl.google.com/android/repository/addons_list-3.xml
Warning: Failed to connect to host: https://dl.google.com/android/repository/addons_list-2.xml
Warning: Failed to connect to host: https://dl.google.com/android/repository/addons_list-1.xml
Warning: Failed to download any source lists!
Warning: java.net.UnknownHostException: dl.google.com

```

which IMHO should not happen for my setup ?!

but never mind – it’s building again… 😉

---

<div class="post-metadata">

**Author:** ![gounthar](https://avatars.discourse-cdn.com/v4/letter/g/977dab/32.png) [@gounthar](https://discuss.gradle.org/u/gounthar)\
**Post date:** [September 7, 2017, 9:50am UTC](https://discuss.gradle.org/t/http-s-proxy-problem/23427/3 "2017-09-07T09:50:11Z")

</div>

I have the same kind of problem with SDK 24 and 25.  
sdkmanager can update, but not the gradle plugin behind a proxy.  
This is solved with gradle-plugin version 3.0.0-beta1 and later.  
What look strange to me is that gradle picks up proxy options:  
Picked up \_JAVA\_OPTIONS: -Dhttp.proxyHost=sample.localnet -Dhttp.proxyPort=80 -Dhttps.proxyHost=sample.localnet -Dhttps.proxyPort=80  
Here are the system variables

> ```
> GRADLE_OPTS='-Dorg.gradle.daemon=false -Dandroid.builder.sdkDownload=true -Dorg.gradle.jvmargs=-Xmx2048M -Dhttp.proxyHost=sample.localnet -Dhttp.proxyPort=80 -Dhttps.proxyHost=sample.localnet -Dhttps.proxyPort=80'
> HTTPS_PROXY=http://sample.localnet:80
> HTTP_PROXY=http://sample.localnet:80
> _JAVA_OPTIONS='-Dhttp.proxyHost=sample.localnet -Dhttp.proxyPort=80 -Dhttps.proxyHost=sample.localnet -Dhttps.proxyPort=80'
> http_proxy=http://sample.localnet:80
> https_proxy=http://sample.localnet:80
> 
> ```
