Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 403
Niya Avatar asked Dec 14 '22 07:12

Niya


1 Answers

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

like image 86
Nazarii Moshenskiy Avatar answered Dec 21 '22 11:12

Nazarii Moshenskiy