Error 403 when trying to "synchronize project with Gradle"

Asked

Viewed 994 times

2

When I open Android Studio, it fails to synchronize the project with this "Gradle", it returns the following error in "Messages Gradle Sync"

Error: Could not GET 'http://jcenter.bintray.com/com/android/tools/build/gradle/0.12.2/gradle-0.12.2.jar'. Received status code 403 from server: Forbidden Enable Gradle 'offline mode' and sync project

Imagery:

Imagem do erro

build.Gradle:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.12.2'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        mavenCentral()
    }
}

Gradle-wrapper.properties

#Wed Apr 10 15:27:10 PDT 2013
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip

You know what it can be?

2 answers

2


It seems to me that Jcenter does not yet have the com.android.tools.build which is used in Gradle to build apk.

Packages exist (the url for it is: http://jcenter.bintray.com/android/tools/build/gradle/0.12.2/#Gradle-0.12.2.jar), but Gradle or Android Studio is having some problem getting these packages (protocol or something), which generates the error 403.

Change the repository jcenter of the definition of buildscript for mavenCentral. This is a bug that has a Issue that has not been resolved yet.

Your build.Radle should stay:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        // Troquei o jcenter pelo mavenCentral. Depois que o issue for resolvido, pode voltar ao normal
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.12.2'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        mavenCentral()
    }
}

The fact of using the mavenCentral in the repository definition for all projects does not affect the repository used for the buildscript, by the definition of buildscript be more specific.

  • very good congratulations

  • "Depois que o issue for resolvido, pode voltar ao normal". It is mandatory to return to normal?

  • It’s not mandatory, I wore the mavenCentral, but it seems to me that they (Google) are "forcinga migração para ojcenterpor alguma razão (não sei ainda). Essa migração é vista quando você cria um projeto Android novo no Android Studio e ele coloca ojcentercomo padrão em vez domavenCentral` (which was the previous standard). This question by SO en comments on the subject.

1

If you are on a firewalled network this may be the problem following the solution

No Android Studio va em File>Settings>Gradle>Global Gradle Settings and in the Gradle VM options and specify the proxy data:

-Dhttp.proxyHost=dummyHost -Dhttp.proxyPort=dummyPort -Dhttp.proxyUser=dummyUser -Dhttp.proxyPassword=dummyPassword 

Filling in with your data of course.

  • hope I’ve helped

  • I think the company network does not own Proxy. How do I find out? Here in the settings is with automatic proxy.

  • would need to be with someone who has the knowledge in the company to see if it has proxy or if it has some kind of transparent proxy case lock. so research that your mistake is due to this

Browser other questions tagged

You are not signed in. Login or sign up in order to post.