Gradle error : Server returned HTTP response code: 403 for URL: http://services.gradle.org/distributions/gradle-2.2.1-all.zip
Asked Answered
C

1

9

I have this error in the apps that I'm currently building on:

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)

I've tried already the suggestions in How to Setup gradle-2.2.1-all.zip Manually, but the same error keeps appearing.

Is there any other way or thing I need to do?

Caltanissetta answered 7/11, 2020 at 3:43 Comment(1)
I don't really do android but here's my suggestions: Thats quite an old version of gradle, are you sure you don't want to use a more recent version? Additionally http://services.gradle.org/distributions/ seems to redirect to a https version of the site which could explain why you can't download with http. IIRC old versions of maven have a similar issue.Renaerenaissance
P
20

Just use https: replace

http://services.gradle.org/distributions/gradle-2.2.1-all.zip with https://services.gradle.org/distributions/gradle-2.2.1-all.zip

The problem is that you use http instead of https. You can check it in your browser and link with https will start downloading file while your link with http will return 403 error

Plunkett answered 7/11, 2020 at 4:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.