Gradle error : Server returned HTTP response code: 403 for URL: http://services.gradle.org/distributions/gradle-2.2.1-all.zip
Gradle error : Server returned HTTP response code: 403 for URL: http://services.gradle.org/distributions/gradle-2.2.1-all.zip
我目前正在构建的应用程序中出现此错误:
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.call(Install.java:60)
at org.gradle.wrapper.Install.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)
我已经尝试过
,但一直出现同样的错误。
我还需要做其他事情吗?
只需使用 https: replace
http://services.gradle.org/distributions/gradle-2.2.1-all.zip
与 https://services.gradle.org/distributions/gradle-2.2.1-all.zip
问题是您使用 http
而不是 https
。您可以在浏览器中检查它,link 和 https
将开始下载文件,而您的 link 和 http
将 return 403 错误
我目前正在构建的应用程序中出现此错误:
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.call(Install.java:60)
at org.gradle.wrapper.Install.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)
我已经尝试过
我还需要做其他事情吗?
只需使用 https: replace
http://services.gradle.org/distributions/gradle-2.2.1-all.zip
与 https://services.gradle.org/distributions/gradle-2.2.1-all.zip
问题是您使用 http
而不是 https
。您可以在浏览器中检查它,link 和 https
将开始下载文件,而您的 link 和 http
将 return 403 错误