当前位置: 首页 > 知识库问答 >
问题:

下载Gradle时Ionic build Android错误

霍书
2023-03-14
>npm install -g cordova
>npm install -g ionic
>ionic start test blank
>cd test
>ionic platform add android
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)
        at java.io.FilterInputStream.read(FilterInputStream.java:133)
        at sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(Http
URLConnection.java:3335)
        at sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(Http
URLConnection.java:3328)
        at org.gradle.wrapper.Download.downloadInternal(Download.java:63)
        at org.gradle.wrapper.Download.download(Download.java:45)
        at org.gradle.wrapper.Install$1.call(Install.java:60)
        at org.gradle.wrapper.Install$1.call(Install.java:47)
        at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAcc
essManager.java:65)
        ... 3 more

C:\Users\LENOVO2014\myApp\platforms\android\cordova\node_modules\q\q.js:126
                    throw e;
                          ^
Error code 1 for command: cmd with args: /s /c "C:\Users\LENOVO2014\myApp\platfo
rms\android\gradlew cdvBuildDebug -b C:\Users\LENOVO2014\myApp\platforms\android
\build.gradle -Dorg.gradle.daemon=true"
ERROR building one of the platforms: Error: C:\Users\LENOVO2014\myApp\platforms\
android\cordova\build.bat: Command failed with exit code 1
You may not have the required environment or OS to build this project
Error: C:\Users\LENOVO2014\myApp\platforms\android\cordova\build.bat: Command fa
iled with exit code 1
    at ChildProcess.whenDone (C:\Users\LENOVO2014\AppData\Roaming\npm\node_modul
es\cordova\node_modules\cordova-lib\src\cordova\superspawn.js:131:23)
    at ChildProcess.emit (events.js:110:17)
    at maybeClose (child_process.js:1015:16)
    at Process.ChildProcess._handle.onexit (child_process.js:1087:5)

共有1个答案

沃阳曜
2023-03-14

我使用的是Ionic版本1.7.14和下面文件中的distributionUrl。MyApp/Platforms/Android/Cordova/lib/builders/gradlebuilder.js.

我必须指出本地下载的gradle在这个答案中指定。

我也有同样的问题。我将gradle添加到我的脱机项目中。

var distributionUrl = 'distributionUrl=http\\://services.gradle.org/distributions/gradle-2.2.1-all.zip';
var distributionUrl = 'distributionUrl=../gradle-2.2.1-all.zip';
 类似资料:
  • 我正在尝试添加以下依赖项:

  • 问题内容: 我试图熟悉夏季爱好的构建应用程序。但是,在过去几天中,当我尝试同步Gradle时,出现了相同的错误,指出 gradle-core.jar无法下载。 我将在这篇文章的底部发布完整的错误消息。 当然,我确保我不在离线模式下工作。最重要的是,我强迫使用来获取源。我还将文件中distributionUrl 更改为。我尝试了不同的代理,并已将build.gradle文件中的存储库更改为. 我什至

  • 我正在使用Gradle构建工具,但我无法获得spark-core的源代码和文档。我已经搜索并申请了: 但它仍然不适合我。我想我缺少了一些东西,比如重建整个项目或下载这些片段。 我申请了<代码>。/gradlew cleanIdea idea也是如此。 当我尝试点击SparkConf.class上的命令并按下< code >下载源代码时,我得到< code > Sources not found f

  • 我用gradle下载常春藤罐子,gradle脚本如下: } } 我的常春藤配置是这样的: 常春藤上的罐子名称是: http://my.company/his-libs/org.slf4j/slf4j-api/1.6.4/slf4j-api-1.6.4.jar 但是当我使用gradle下载它们时,jar的名称是: D:\Users\myname。gradle\caches\artifacts-23\