Q:

Building Ionic Android App Throwing a Gradle Exception

I am runing : ionic cordova build android
The following stacktrace is thrown: 
  ...org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:129)
  ...java.net.ConnectException: Connection timed out: connect
  Caused by: java.net.ConnectException: Connection timed out: connect
             at java.net.DualStackPlainSocketImpl.connect0(Native Method)

I am behind a corporate proxy, could this be the issue?

A:

To let gradle access the internet via the proxy, in your platforms/android folder, in your gradle.properties file (create it if doesn't exist) add the following:
systemProp.http.proxyHost=<your proxy ip or host>
systemProp.http.proxyPort=<your proxy port>
systemProp.http.proxyUser=<ur user if any>
systemProp.http.proxyPassword=<ur pass if any>
systemProp.https.proxyHost=<your proxy ip or host>
systemProp.https.proxyPort=<your proxy port>
systemProp.https.proxyUser=<ur user if any>
systemProp.https.proxyPassword=<ur passif any>

PS: please note that the file will be overwritten if you ever re-generated your platforms projects with cordova/ionic.

