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()
    }
}
Rich Luick
  • 2,354
  • 22
  • 35

2 Answers2

1

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
    }
}
Henry
  • 17,490
  • 7
  • 63
  • 98
  • Thanks, thats exactly what the build.gradle looks like(see my edit). So this is going to be a proxy issue? Right now I am just running the server locally on localhost:8080 just for setup – Rich Luick Oct 23 '15 at 14:33
  • Ok, so you have the Jenkins running in your own system? If so, could you run the gradle script locally via the command promt in your own system ? – Henry Oct 23 '15 at 14:40
  • Thanks, this turned out to 100% be an issue with the proxy config. Unfortunately the error is not too descriptive but thanks for the answer! – Rich Luick Oct 23 '15 at 14:45
0

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!

Rich Luick
  • 2,354
  • 22
  • 35