简体   繁体   中英

Build fails on Jenkins for my Android project due to config

I am trying to setup Jenkins Job for my android project. The Project is getting built successfully on my local machine but fails on Jenkins with following error:

A problem occurred configuring project ':app' Cannot evaluate module volley : Configuration with name 'default' not found.

.gitmodules

[submodule "volley"]
    path = volley
    url = https://android.googlesource.com/platform/frameworks/volley

app: build.gradle file

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

android {
    signingConfigs {
        release {
            storeFile file('my-release-key.keystore')
            storePassword "******"
            keyAlias "release-key"
            keyPassword "*******"
        }
    }

    applicationVariants.all { variant ->
        variant.outputs.each { output ->
            def outputFile = output.outputFile
            if (outputFile != null && outputFile.name.endsWith('.apk')) {
                def fileName = outputFile.name.replace('app-release.apk', "myproject.apk")
                output.outputFile = new File(outputFile.parent, fileName)
            }
        }
    }

    lintOptions {
        abortOnError false
    }

    configurations.all {
        resolutionStrategy.force 'com.android.support:support-annotations:23.1.0'
    }

    compileSdkVersion 23
    buildToolsVersion "23.0.1"
    defaultConfig {
        applicationId "com.myproject.****"
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        signingConfig signingConfigs.release
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        //setProperty("archivesBaseName", "myproject")
    }
    buildTypes {
        release {
            minifyEnabled false
            shrinkResources true
            debuggable false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
        debug {
            debuggable true
        }
    }
    packagingOptions {
        exclude 'LICENSE.txt'
    }
    productFlavors {
    }
    testOptions {
        unitTests.returnDefaultValues = true
    }
    sourceSets { main { java.srcDirs = ['src/main/java'] } }
}


dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile project(':volley')
    androidTestCompile 'com.android.support.test:runner:0.4'
    androidTestCompile 'com.android.support.test:rules:0.4'
    androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.1'
    testCompile 'junit:junit:4.12'
    testCompile 'org.mockito:mockito-core:1.10.19'
    testCompile files('libs/json.jar')
    testCompile 'org.json:json:20140107'
    compile 'com.google.android.gms:play-services-identity:8.3.0'
    compile 'com.google.android.gms:play-services-plus:8.3.0'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:design:23.1.1'
    compile 'com.android.support:cardview-v7:23.1.1'
    compile 'com.android.support:recyclerview-v7:23.1.1'
    compile 'org.apache.commons:commons-lang3:3.4'
    compile 'com.github.clans:fab:1.6.1'
    compile 'de.hdodenhof:circleimageview:2.0.0'
    compile 'com.squareup.okhttp:okhttp:2.6.0'
    compile 'com.google.code.gson:gson:2.2.4'
}
apply plugin: 'idea'

settings.gradle

include ':app' , ':volley'

project-- 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:1.3.0'
        classpath 'com.google.gms:google-services:1.5.0-beta2'

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

allprojects {
    repositories {
        jcenter()
    }
}

I have set up volley by cloning the repo

https://android.googlesource.com/platform/frameworks/volley

I have tried changing the path of volley and recloning also but it didn't worked

That error message looks like the volley submodule has not been cloned into the workspace.
You should not clone this manually, but let Jenkins do it for you.

Jenkins doesn't clone submodules by default (for some unknown reason), but you can enable this in your job configuration. In the Git section, choose:
Additional Behaviours > Add > Advanced sub-modules behaviours

You can additionally check the "Recursively clone submodules" option in the section that appears, but I don't think volley needs this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM