gpt4 book ai didi

windows - ionic 构建 android 失败,来自 Gradle 的 403 Http 响应,JAVA_HOME 无效

转载 作者:可可西里 更新时间:2023-11-01 09:24:04 25 4
gpt4 key购买 nike

我正在使用 Windows 7X64 机器并尝试使用 cordova/ionic CLI v1.5.5 构建 Andriod 应用程序。我收到无法解决的错误。

"You may not have the required environment or OS to build this project"

使用命令ionic build androidcordova build android。命令 ionic platform add android 成功。我正在使用 Android SDK 管理器处理 Android sdk (API 22)。我还确保正确设置了 PATH 变量。

完整的过程记录是:

C:\Users\ddevkota\Desktop\freshIonic>ionic build android
Running command: "C:\Program Files\nodejs\node.exe" C:\Users\ddevkota\Desktop\fr
eshIonic\hooks\after_prepare\010_add_platform_class.js C:\Users\ddevkota\Desktop
\freshIonic
add to body class: platform-android
Running command: cmd "/s /c "C:\Users\ddevkota\Desktop\freshIonic\platforms\andr
oid\cordova\build.bat""
ANDROID_HOME=C:\Users\ddevkota\AppData\Local\Android\sdk
JAVA_HOME=C:\Progra~1\Java\jdk1.7.0_15
Running: C:\Users\ddevkota\Desktop\freshIonic\platforms\android\gradlew cdvBuild
Debug -b C:\Users\ddevkota\Desktop\freshIonic\platforms\android\build.gradle -Do
rg.gradle.daemon=true
Downloading http://services.gradle.org/distributions/gradle-2.2.1-all.zip

Exception in thread "main" java.lang.RuntimeException: java.io.IOException: Serv
er returned HTTP response code: 403 for URL: http://services.gradle.org/distribu
tions/gradle-2.2.1-all.zip
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.io.IOException: Server returned HTTP response code: 403 for URL:
http://services.gradle.org/distributions/gradle-2.2.1-all.zip
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLCon
nection.java:1625)
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

C:\Users\ddevkota\Desktop\freshIonic\platforms\android\cordova\node_modules\q\q.
js:126
throw e;
^
Error code 1 for command: cmd with args: /s /c "C:\Users\ddevkota\Desktop\freshI
onic\platforms\android\gradlew cdvBuildDebug -b C:\Users\ddevkota\Desktop\freshI
onic\platforms\android\build.gradle -Dorg.gradle.daemon=true"
ERROR building one of the platforms: Error: cmd: Command failed with exit code 1

You may not have the required environment or OS to build this project
Error: cmd: Command failed with exit code 1
at ChildProcess.whenDone (C:\Users\ddevkota\AppData\Roaming\npm\node_modules
\cordova\node_modules\cordova-lib\src\cordova\superspawn.js:134: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)

提前感谢您的帮助。

最佳答案

注意:这证明是客户端 (403) 中的权限问题。我将我的机器连接到不同的网络并开始工作。所有构建过程。如果你想手动完成,这里是我得到的程度。

not Valid JAVA_HOME的解决方法

在花了几天时间卸载所有版本的 java 后,只重新安装一个版本并将环境变量 JAVA_HOME 设置为 C:\Program Files\Java\jdk1.7.0_15我解决了这个问题。

但是在下载gradle时又出现了ionic build android error的问题。

当我离线将 gradle 添加到我的项目时,这个问题得到了解决。

not Gradle 403 Http response的解决方法

执行以下操作:从已发布的链接(这里是 https://services.gradle.org/distributions/gradle-2.2.1-all.zip)下载 gradle 后,将其粘贴到 myApp\platforms\android\gradle\gradle-2.2.1-all.zip 的 build.js 中>myApp\platforms\android\cordova\lib\build.js 找到这个:

var distributionUrl = 'distributionUrl=https://services.gradle.org/distributions/gradle-2.2.1-all.zip';

并将其替换为您自己的文件位置:

var distributionUrl = 'distributionUrl=../gradle-2.2.1-all.zip';

仍在构建中,并将继续发布解决方案。在 ionic 论坛中创建了一个关于其他问题的线程,它是 here .

关于windows - ionic 构建 android 失败,来自 Gradle 的 403 Http 响应,JAVA_HOME 无效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31167159/

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