Using Jenkins to build an android gradle project fails

I’m trying to setup Jenkins on a computer running OSX and I’m running into a problem.

When I’m trying to build the project with my default user account everything works fine, but as soon as im trying to build via Jenkins the build fails with the following output:

  • How to create a drop down view like Google Calendar using Toolbar?
  • How to size an Android view based on its parent's dimensions
  • Offline maps SDK for Android and iOS
  • Android installLocation and BOOT_COMPLETED
  • Is there a OAuth2 library for Java / Android already?
  • PorterDuff color effects in android for views under a given view
  • FAILURE: Build failed with an exception.
    * What went wrong:
    A problem occurred configuring project ':Project'.
    > Failed to notify project evaluation listener.
        > A problem occurred configuring project ':libraries:actionbarsherlock'.
            > Failed to notify project evaluation listener.
                > Could not resolve all dependencies for configuration ':libraries:actionbarsherlock:compile'.
                    > Could not find
                      Required by:

    My build.gradle for the project ‘libraries:actionbarsherlock’ looks like this:

    buildscript {
        repositories {
            maven { url '' }
        dependencies {
            classpath ''
    apply plugin: 'android-library'
    dependencies {
        compile ''
    android {
        compileSdkVersion 17
        buildToolsVersion "17.0.0"
        defaultConfig {
            minSdkVersion 7
            targetSdkVersion 16
        sourceSets {
            main {
                manifest.srcFile 'AndroidManifest.xml'
                java.srcDirs = ['src']
                resources.srcDirs = ['src']
                res.srcDirs = ['res']

    As far as I know the dependency to should be satisfied through the local maven repository installed via the Android SDK Manager. As I said this is working when building on my user account, but it seems to fail when trying to build with Jenkins.


    I was able to resolve this issue by checking the user permissions on my android-sdk folder. Problem seemed to be that while the jenkins user had read&write permissions on the android sdk root folder it was lacking the permissions to access stuff installed through the android sdk manager.

  • RelativeLayout align parent *side* + margin *side*
  • WebView methods on same thread error
  • How to show Snackbar when Activity starts?
  • not getting generated with Intellij Idea 12
  • ActionBarSherlock Item Icon strange width with Android 4.3
  • How to know if an app has been downloaded from Google Play or Amazon?
  • 3 Solutions collect form web for “Using Jenkins to build an android gradle project fails”

    I was able to solve this issue just now for myself.


    1. Create a file in the root directory of your project called “”
    2. Put only the following in the file:

    Then Rebuild and it should work. This was on Fedora Linux for reference.

    • Go to Jenkins > Manage Jenkins > Configure System
    • Check “Environment variables”
    • add name: ANDROID_HOME, value -> your android sdk dir
    • click “add”

    It just looks like the Android SDK on your jenkins box does not have the “Android Support Repository” component installed.

    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.