cordova Gradle错误:服务器返回HTTP响应代码:403用于URL:http://services.gradle.org/distributions/gradle-2.2.1-all.zip

8ulbf1ek  于 2022-11-15  发布在  其他
关注(0)|答案(1)|浏览(288)

我目前正在建置的应用程序中发生此错误:

C:\mobile\xtern_mobile\ST>cordova run android
ANDROID_HOME=C:\Users\myPC\AppData\Local\Android\android-sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_66
Downloading http://services.gradle.org/distributions/gradle-2.2.1-all.zip

Exception in thread "main" java.lang.RuntimeException: java.io.IOException: Server returned HTTP response code: 403 for URL: http://services.gradle.org/distributions/gradle-2.2.1-all.zip
        at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.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.getInputStream0(HttpURLConnection.java:1840)
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441)
        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(ExclusiveFileAccessManager.java:65)
        ... 3 more
CordovaError: Promise rejected with non-error: Error code 1 for command: cmd with args: /s,/c,"C:\mobile\xtern_mobile\ST\platforms\android\gradlew cdvBuildDebug -b C:\mobile\xtern_mobile\ST\platforms\android\build.gradle -Dorg.gradle.daemon=true -Pandroid.useDeprecatedNdk=true"
    at C:\Users\myPC\AppData\Roaming\npm\node_modules\cordova\bin\cordova:30:15
    at processTicksAndRejections (internal/process/task_queues.js:93:5)

我已经尝试了How to Setup gradle-2.2.1-all.zip Manually中的建议,但仍然出现相同的错误。
还有什么其他的方法或事情需要我做吗?

bvjveswy

bvjveswy1#

只需使用https:取代了
http://services.gradle.org/distributions/gradle-2.2.1-all.ziphttps://services.gradle.org/distributions/gradle-2.2.1-all.zip合并
问题是您使用的是http而不是https。您可以在浏览器中检查它,与https链接将开始下载文件,而与http链接将返回403错误

相关问题