gpt4 book ai didi

android - 在 CLI 上运行 cordova build 命令时出现 Gradle 2.2.1 错误

转载 作者:搜寻专家 更新时间:2023-11-01 07:53:41 26 4
gpt4 key购买 nike

我最近将 Cordova 更新到 5.1.1,将 JDK 更新到 1.7.0.79。我还创建了一个新的 Cordova android 项目。但是当我尝试使用 CLI 构建项目时,出现以下错误:

Your environment has been set up for using Node.js 0.10.28 (ia32) and npm.

C:\Documents and Settings\Administrator>F:

F:\>cd shishutosh

F:\shishutosh>cordova build android
Running command: cmd "/s /c "F:\shishutosh\platforms\android\cordova\build.bat""

ANDROID_HOME=E:\Backup\Software\adt-bundle-windows-x86-20130729\adt-bundle-windo
ws-x86-20130729\sdk\
JAVA_HOME=C:\Program Files\Java\jdk1.7.0_79
Running: F:\shishutosh\platforms\android\gradlew cdvBuildDebug -b F:\shishutosh\
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.UnknownHostExcep
tion: services.gradle.org
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.UnknownHostException: services.gradle.org
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java
:178)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:579)
at java.net.Socket.connect(Socket.java:528)
at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:211)
at sun.net.www.http.HttpClient.New(HttpClient.java:308)
at sun.net.www.http.HttpClient.New(HttpClient.java:326)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLC
onnection.java:997)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConne
ction.java:933)
at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection
.java:851)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLCon
nection.java:1301)
at org.gradle.wrapper.Download.downloadInternal(Download.java:59)
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

F:\shishutosh\platforms\android\cordova\node_modules\q\q.js:126
throw e;
^
Error code 1 for command: cmd with args: /s /c "F:\shishutosh\platforms\android\
gradlew cdvBuildDebug -b F:\shishutosh\platforms\android\build.gradle -Dorg.grad
le.daemon=true"
ERROR building one of the platforms: Error: cmd: Command failed with exit code 8

You may not have the required environment or OS to build this project
Error: cmd: Command failed with exit code 8
at ChildProcess.whenDone (C:\Documents and Settings\Administrator\Applicatio
n Data\npm\node_modules\cordova\node_modules\cordova-lib\src\cordova\superspawn.
js:134:23)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:753:16)
at Process.ChildProcess._handle.onexit (child_process.js:820:5)

F:\shishutosh>

我已经手动安装了Grandle并设置了环境变量。并验证如下:

    F:\Rong>gradle -v

------------------------------------------------------------
Gradle 2.2.1
------------------------------------------------------------

Build time: 2014-11-24 09:45:35 UTC
Build number: none
Revision: 6fcb59c06f43a4e6b1bcb401f7686a8601a1fb4a

Groovy: 2.3.6
Ant: Apache Ant(TM) version 1.9.3 compiled on December 23 2013
JVM: 1.7.0_79 (Oracle Corporation 24.79-b02)
OS: Windows 2003 5.2 x86

我之前创建的项目运行 CLI“BUILD COMMAND”没有任何错误。谁能给我一些解决方案。

提前致谢。

注意我支持公司代理。

最佳答案

我遇到了同样的问题。我想不通,但如果您安装了 ANT 并配置了路径,则有一个解决方法。尝试命令“cordova build android -- --ant”(仍在寻找正确的解决方案)

关于android - 在 CLI 上运行 cordova build 命令时出现 Gradle 2.2.1 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31260967/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com