Rich Luick
Rich Luick

Reputation: 2364

Jenkins with Android Gradle Could not resolve com.android.tools.build:gradle:1.3.1

I am having trouble setting up an Android project on Jenkins using the Gradle plugin. I am getting the following error message:

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'tablet_optimizations'.
> Could not resolve all dependencies for configuration ':classpath'.
   > Could not resolve com.android.tools.build:gradle:1.3.1.
     Required by:
         :tablet_optimizations:unspecified
      > Could not resolve com.android.tools.build:gradle:1.3.1.
         > Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/1.3.1/gradle-1.3.1.pom'.
            > Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/1.3.1/gradle-1.3.1.pom'. Received status code 403 from server: Forbidden

This is pulling a repo from SVN through a proxy, both of which seem to be set up properly. But maybe that could be an issue here. I am also pointing towards Gradle 2.4 for this project. I have seen a few issues similar to this on here but nothing seems to be helping. I will update with any additional info if needed! Please Help!!! Thanks!

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

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

allprojects {
    repositories {
        jcenter()
    }
}

Upvotes: 1

Views: 4028

Answers (2)

Rich Luick
Rich Luick

Reputation: 2364

Okay, so this turned out to be an issue getting through the proxy. The error message was a little misleading and made me believe this was a Gradle issue. I will post my config below in hopes it will help someone.

In the Manage Jenkins/Configure System page create a new "Environment Variable" under the "Global Properties" section:

name: GRADLE_OPTS

value: -Dhttp.proxyHost=<your proxy> -Dhttp.proxyPort=<your port> -Dhttps.proxyHost=<your proxy> -Dhttps.proxyPort=<your port> -Dorg.gradle.java.home=<your path to java jdk>

Maybe this can help someone with a similar issue!

Upvotes: 0

Henry
Henry

Reputation: 17851

You are getting a 403 error.

Status code 403 responses are the result of the web server being configured to deny access, for some reason, to the requested resource by the client.

I had the same issue, because I was behind a firewall that just didn't allow the repository site.

Also your build.gradle should look like this:

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

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

Upvotes: 1

Related Questions