Error 403 when trying to "synchronize the project with Gradle"

2

When I open Android Studio, it can not 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

Image:

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

Do you know what it can be?

    
asked by anonymous 27.08.2014 / 13:56

2 answers

2

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

Packages exist (the url for it is: ), but the gradle or Android Studio has some problem getting these packages (protocol or something), which generates the error 403 .

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

Your build.gradle should be:

// 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()
    }
}

Using mavenCentral in the repository definition for all projects does not affect the repository used for buildscript , by setting buildscript to be more specific.

    
29.08.2014 / 15:25
1

If you are in a network with a firewall this may be the problem following the solution

In Android Studio go to File>Settings>Gradle>Global Gradle Settings and Gradle VM options and specify proxy data:

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

Filling in with your data of course.

    
29.08.2014 / 14:04