下载Gradle时离子生成Android错误

我对Ionic框架很陌生:)


>npm install -g cordova

>npm install -g ionic

>ionic start test blank

>cd test

>ionic platform add android

当我使用' >ionic build android'时,开始下载gradle,但无法下载并出现错误。


是什么导致此错误,我该如何解决?


我下载了Gradle并将其安装在PC上,但它想再次下载。我可以离线将Gradle添加到项目中吗?


C:\Users\LENOVO2014\test>ionic build android

running cordova build android

Running command: "C:\Program Files\nodejs\node.exe" C:\Users\LENOVO2014\myApp\ho

oks\after_prepare\010_add_platform_class.js C:\Users\LENOVO2014\myApp

add to body class: platform-android

Running command: C:\Users\LENOVO2014\myApp\platforms\android\cordova\build.bat

ANDROID_HOME=D:\program\Programing\Android\sdk

JAVA_HOME=C:\Program Files\Java\jdk1.8.0_31

Running: C:\Users\LENOVO2014\myApp\platforms\android\gradlew cdvBuildDebug -b C:

\Users\LENOVO2014\myApp\platforms\android\build.gradle -Dorg.gradle.daemon=true

Downloading http://services.gradle.org/distributions/gradle-2.2.1-all.zip

................................................................................

................................................................................

................................................................................

............................................

Exception in thread "main" java.lang.RuntimeException: java.net.SocketException:

 Connection reset

        at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAcc

essManager.java:78)

        at org.gradle.wrapper.Install.createDist(Install.java:47)

        at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:129)

        at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:48)

Caused by: java.net.SocketException: Connection reset

        at java.net.SocketInputStream.read(SocketInputStream.java:189)

        at java.net.SocketInputStream.read(SocketInputStream.java:121)

        at java.io.BufferedInputStream.read1(BufferedInputStream.java:284)

        at java.io.BufferedInputStream.read(BufferedInputStream.java:345)

        at sun.net.www.MeteredStream.read(MeteredStream.java:134)

炎炎设计
浏览 476回答 3
3回答

慕田峪7331174

由于上面发布的解决方案需要将.zip包含到大约55MB的文件夹中您还可以通过以下命令强制CLI在构建过程中使用Ant而不是gradle:cordova build android -- --ant
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java
Android