When running ionic build android inside root folder of a project, build fails when downloading https://services.gradle.org/distributions/gradle-3.3-all.zip with
```Exception in thread "main"
java.net.ConnectException: Connection refused (Connection refused)
#### Output of `ionic build android`
[email protected] ionic:build /Users/oikonomopo/Projects/myNewProject
ionic-app-scripts build
[18:49:16] ionic-app-scripts 1.3.7
[18:49:16] build dev started ...
[18:49:16] clean started ...
[18:49:16] clean finished in 75 ms
[18:49:16] copy started ...
[18:49:16] transpile started ...
[18:49:28] transpile finished in 11.72 s
[18:49:28] preprocess started ...
[18:49:28] deeplinks started ...
[18:49:28] deeplinks finished in 16 ms
[18:49:28] preprocess finished in 18 ms
[18:49:28] webpack started ...
[18:49:30] copy finished in 13.82 s
[18:49:55] webpack finished in 27.83 s
[18:49:56] sass started ...
[18:49:59] sass finished in 3.48 s
[18:49:59] postprocess started ...
[18:49:59] postprocess finished in 45 ms
[18:49:59] lint started ...
[18:49:59] build dev finished in 43.37 s
[18:50:10] lint finished in 10.96 s
ANDROID_HOME=/Users/oikonomopo/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home
Subproject Path: CordovaLib
Downloading https://services.gradle.org/distributions/gradle-3.3-all.zip
Exception in thread "main"
java.net.ConnectException: Connection refused (Connection refused)
at java.net.PlainSocketImpl.socketConnect(Native Method)
...
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:107)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
Error: /Users/oikonomopo/Projects/myNewProject/platforms/android/gradlew: Command failed with exit code 1 Error output:
Exception in thread "main" java.net.ConnectException: Connection refused (Connection refused)
...
at org.gradle.wrapper.Download.downloadInternal(Download.java:60)
at org.gradle.wrapper.Download.download(Download.java:45)
at org.gradle.wrapper.Install$1.call(Install.java:62)
at org.gradle.wrapper.Install$1.call(Install.java:48)
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:69)
at org.gradle.wrapper.Install.createDist(Install.java:48)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:107)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
#### Expecting behavior
I expect to download `https://services.gradle.org/distributions/gradle-3.3-all.zip` and finish build!
----
#### Steps to reproduce
In a blank tempalte project just run `ionic build android`
----
#### Output of `ionic info`
Your system information:
Cordova CLI: 7.0.1
Ionic Framework Version: 3.3.0
Ionic CLI Version: 2.2.3
Ionic App Lib Version: 2.2.1
Ionic App Scripts Version: 1.3.7
ios-deploy version: Not installed
ios-sim version: Not installed
OS: macOS Sierra
Node Version: v6.10.3
Xcode version: Xcode 8.3.2 Build version 8E2002
#### Other information
I am using `blank template ` for my project. I have created a `gradle.properties` file in _project build dir_ and in _gradle user home_ based to [gradle docs](https://docs.gradle.org/current/userguide/build_environment.html#sec:accessing_the_web_via_a_proxy):
systemProp.http.proxyHost=http://i.am.a.proxy.com
systemProp.http.proxyPort=8080
systemProp.https.proxyHost=http://i.am.a.proxy.com
systemProp.https.proxyPort=8080
```
Hi, we aren't supporting CLI v2 anymore. Also, this is a question for gradle, not Ionic.
Although it's related to _gradle_ and not to _ionic_, this was my issue/solution:
For me the issue was the http prefix! If this is your case, remove http/https prefixes!
I had my gradle.properties like this, and was failing:
systemProp.http.proxyHost=http://squid.proxy.com
systemProp.http.proxyPort=8080
systemProp.https.proxyHost=http://squid.proxy.com
systemProp.https.proxyPort=8080
Proper way to set proxy settings for gradle is:
systemProp.http.proxyHost=squid.proxy.com systemProp.http.proxyPort=8080 systemProp.https.proxyHost=squid.proxy.com systemProp.https.proxyPort=8080
Most helpful comment
Although it's related to _gradle_ and not to _ionic_, this was my issue/solution:
For me the issue was the
httpprefix! If this is your case, removehttp/httpsprefixes!I had my gradle.properties like this, and was failing: