Jenkins Gradle构建问题(任务执行失败':app:processPackagingOptionsDebugResources'。)

时间:2016-03-06 12:22:29

标签: android jenkins aapt gradle-plugin

我正在尝试使用Gradle插件通过Jenkins构建Android App。当我添加应用程序时,我将在下面粘贴以下异常。这个应用程序使用Android Studio运行良好,但无法使用Jenkins构建。请让我知道,可能是什么问题。

C:\Program Files (x86)\Jenkins\workspace\Test\AndroidApp\app\src\main\res\values-v21\styles.xml:2 : Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.ProgressBar.Horizontal'.
C:\Program Files (x86)\Jenkins\workspace\Test\AndroidApp\app\src\main\res\values-v21\styles.xml:2 : Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.DrawerArrowToggle'.
C:\Program Files (x86)\Jenkins\workspace\Test\AndroidApp\app\src\main\res\values-v21\styles.xml:2 : Error retrieving parent for item: No resource found that matches the given name '@style/Widget.AppCompat.Light.ActionBar'.
C:\Program Files (x86)\Jenkins\workspace\Test\AndroidApp\app\src\main\res\values-v21\styles.xml:2 : Error retrieving parent for item: No resource found that matches the given name '@style/TextAppearance.AppCompat.Widget.ActionBar.Title'.
C:\Program Files (x86)\Jenkins\workspace\Test\AndroidApp\app\src\main\res\values-v21\styles.xml:2 : Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.NoActionBar'.
C:\Program Files (x86)\Jenkins\workspace\Test\AndroidApp\app\src\main\res\values-v21\styles.xml:2 : Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.
C:\Program Files (x86)\Jenkins\workspace\Test\AndroidApp\app\src\main\res\values-v21\styles.xml:2 : Error retrieving parent for item: No resource found that matches the given name '@style/Widget.AppCompat.ActionMode'.

FAILED
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processPackagingOptionsDebugResources'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'D:\AndroidStudioSDK\build-tools\23.0.2\aapt.exe'' finished with non-zero exit value 1

请在下面找到build.gradle:

buildscript {
repositories {
    maven { url 'https://maven.fabric.io/public' }
}

dependencies {
    classpath 'io.fabric.tools:gradle:1.+'
}

}

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {
    maven { url 'https://maven.fabric.io/public' }
}

class BooleanExtension {
    boolean value

    BooleanExtension(boolean value) {
        this.value = value
    }

    public void setValue(boolean value) {
        this.value = value
    }

    public boolean getValue() {
        return value
    }
}

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"
//    def voiceSearch = false;


    defaultConfig {
        applicationId 'com.packageid'
        versionName "1.0.0"
        minSdkVersion 19
        targetSdkVersion 22
        versionCode 10000

    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
            debuggable false
            jniDebuggable false
            renderscriptDebuggable false
            renderscriptOptimLevel 3
            zipAlignEnabled true
        }
    }



    }




dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:support-v4:23.1.1'

    compile 'com.android.support:design:23.1.1'

    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:recyclerview-v7:23.1.1'
    compile 'com.google.android.gms:play-services-analytics:7.8.0'
    compile 'com.google.android.gms:play-services-base:7.8.0'

    compile('com.crashlytics.sdk.android:crashlytics:2.5.0@aar') {
        transitive = true;
    }
}

我还从value-v21中删除了样式,然后我得到以下异常

Files (x86)\Jenkins\workspace\Test\app\src\main\res\values\strings.xml:2 : Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?
C:\Program Files (x86)\Jenkins\workspace\Test\app\src\main\res\values\strings.xml:2 : Unexpected end tag string
C:\Program Files (x86)\Jenkins\workspace\Test\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\23.1.0\res\values-hdpi\values-hdpi.xml:2 : Error retrieving parent for item: No resource found that matches the given name 'Base.Widget.AppCompat.DrawerArrowToggle.Common'.
C:\Program Files (x86)\Jenkins\workspace\Test\app\build\intermediates\exploded-aar\com.android.support\design\23.1.0\res\values-sw600dp\values-sw600dp.xml:2 : Error retrieving parent for item: No resource found that matches the given name 'Base.Widget.Design.TabLayout'.
C:\Program Files (x86)\Jenkins\workspace\Test\app\build\intermediates\exploded-aar\com.android.support\design\23.1.0\res\values-land\values-land.xml:2 : Error retrieving parent for item: No resource found that matches the given name 'Base.Widget.Design.TabLayout'.
C:\Program Files (x86)\Jenkins\workspace\Test\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\23.1.0\res\values-large\values-large.xml:2 : Error retrieving parent for item: No resource found that matches the given name 'Base.Theme.AppCompat.Dialog.FixedSize'.
C:\Program Files (x86)\Jenkins\workspace\Test\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\23.1.0\res\values-large\values-large.xml:2 : Error retrieving parent for item: No resource found that matches the given name 'Base.Theme.AppCompat.Light.Dialog.FixedSize'.
C:\Program Files (x86)\Jenkins\workspace\Test\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\23.1.0\res\values-v11\values-v11.xml:2 : Error retrieving parent for item: No resource found that matches the given name 'Base.V7.Theme.AppCompat.Dialog'.
C:\Program Files (x86)\Jenkins\workspace\Test\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\23.1.0\res\values-v11\values-v11.xml:2 : Error retrieving parent for item: No resource found that matches the given name 'Base.V7.Theme.AppCompat.Light.Dialog'.
C:\Program Files (x86)\Jenkins\workspace\Test\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\23.1.0\res\values-v12\values-v12.xml:2 : Error retrieving parent for item: No resource found that matches the given name 'Base.V7.Widget.AppCompat.AutoCompleteTextView'.
C:\Program Files (x86)\Jenkins\workspace\Test\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\23.1.0\res\values-v12\values-v12.xml:2 : Error retrieving parent for item: No resource found that matches the given name 'Base.V7.Widget.AppCompat.EditText'.
C:\Program Files (x86)\Jenkins\workspace\Test\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\23.1.0\res\values-v17\values-v17.xml:2 : Error retrieving parent for item: No resource found that matches the given name 'Base.DialogWindowTitle.AppCompat'.
C:\Program Files (x86)\Jenkins\workspace\Test\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\23.1.0\res\values-v21\values-v21.xml:2 : Error retrieving parent for item: No resource found that matches the given name 'Base.V7.Theme.AppCompat'.
C:\Program Files (x86)\Jenkins\workspace\Test\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\23.1.0\res\values-v21\values-v21.xml:2 : Error retrieving parent for item: No resource found that matches the given name 'Base.V7.Theme.AppCompat.Light'.

1 个答案:

答案 0 :(得分:0)

首先要注意的是(Execution failed for task ':app:processPackagingOptionsDebugResources'.) 不是错误。这是由应用中的错误引起的 Gradle错误。那个"你的应用程序错误"是实际错误。

在Gradle错误之上,你可以看到多个应用程序错误(这里有两个例子):

styles.xml:2 : Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.ProgressBar.Horizontal'.
styles.xml:2 : Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.DrawerArrowToggle'.

这些是您的实际错误。现在关于这些。你可以看到它说:

No resource found that matches the given name 'Widget.AppCompat.DrawerArrowToggle'.

通常这是由build.gradle文件中的问题引起的。在android {...}部分,确保将编译sdk和构建工具版本设置为最新版本。因为您使用" values-21",所以您也应该使用v21进行编译:

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.1"
}

希望这有帮助!