构建离子Android应用程序抛出Gradle异常

时间:2017-10-03 06:13:46

标签: angular cordova gradle ionic-framework

我在跑步:ionic cordova build android 抛出以下stacktrace:

  ...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)

我支持公司代理,这可能是问题吗?

1 个答案:

答案 0 :(得分:1)

要让gradle通过代理访问互联网,请在platforms/android文件夹中的gradle.properties文件中创建(如果不存在则创建)添加以下内容:

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:请注意,如果您使用cordova/ionic重新生成平台项目,该文件将被覆盖。