简体   繁体   English

由于配置,我的Android项目在Jenkins上构建失败

[英]Build fails on Jenkins for my Android project due to config

I am trying to setup Jenkins Job for my android project. 我正在尝试为我的android项目设置Jenkins Job。 The Project is getting built successfully on my local machine but fails on Jenkins with following error: 该项目已在我的本地计算机上成功构建,但在Jenkins上失败,并出现以下错误:

A problem occurred configuring project ':app' Cannot evaluate module volley : Configuration with name 'default' not found. 配置项目':app'时发生问题无法评估模块齐射:找不到名称为'default'的配置。

.gitmodules .gitmodules

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

app: build.gradle file 应用:build.gradle文件

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 settings.gradle

include ':app' , ':volley'

project-- build.gradle 项目-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 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. Jenkins默认不克隆子模块(出于某些未知原因),但是您可以在作业配置中启用它。 In the Git section, choose: 在Git部分中,选择:
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. 您还可以在出现的部分中检查“递归克隆子模块”选项,但我认为凌空不需要这个。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Jenkins使用库构建Android项目 - Jenkins build of Android project with library 由于“无法生成DH密钥对”,Jenkins构建失败 - Jenkins build fails due to “Could not generate DH keypair” SpringBootTest 在使用 Docker 构建 Jenkins 期间由于 UnsatisfiedDependencyException 而失败 - SpringBootTest fails due to UnsatisfiedDependencyException during Jenkins build with Docker Spring引导应用程序本地构建传递,但由于测试而在Jenkins中失败 - Spring boot application local build passes, but fails in Jenkins due to Tests Jenkins 无法为我的 Selenium 项目编译 Maven - Jenkins fails to compile Maven for my Selenium Project 使用Oracle Java在Jenkins中构建android项目 - Build android project in jenkins with oracle java 当我使用Ant来构建具有多个库的Android项目时,我的构建失败了 - My build fails when I use Ant to build and Android project with multiple libraries 从Android中的父项目访问Build Config - Access Build Config from parent project in Android 由于无法构建依赖关系的发行版本,因此在Jenkins中Maven发行版构建失败 - Maven release build fails in Jenkins due to failure to build a release version of dependency 由于多个dex文件,Android Gradle构建失败 - Android Gradle build fails due to Multiple dex files
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM