2016-03-06 215 views
-1

我试图通过使用Gradle插件的Jenkins构建Android应用程序。当我申请该应用程序时,我在下面粘贴了以下例外。此应用程序使用Android Studio运行良好,但无法使用Jenkins构建。请让我知道,可能是什么问题。Jenkins Gradle构建问题(任务':app:processPackagingOptionsDebugResources'的执行失败。)

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:[email protected]') { 
     transitive = true; 
    } 
} 

我从价值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'. 
+0

可能重复[找不到与给定名称相匹配的资源'android:Theme.Material.Light.DarkActionBar'](http://stackoverflow.com/questions/24529534/no-resource-found-that-matches-给定名称 - androidtheme-material-light-dark) – Chaoz

回答

0

首先要注意的是(Execution failed for task ':app:processPackagingOptionsDebugResources'.)不是错误。这是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和生成工具版本设置为最新版本。因为你用“值-21”,你应该使用V21编译过:

android { 
    compileSdkVersion 21 
    buildToolsVersion "21.1.1" 
} 

希望这有助于!

+0

是的,我正在使用最新版本 compileSdkVersion 23 buildToolsVersion“23.0.2” – Safy

+0

然后这可能会帮助你:http://stackoverflow.com/questions/ 21059612/no-resource-found-that-matches-the-name-style-theme-appcompat-light – Chaoz

+0

更多suggesstions,我已经更新了这个问题的更多细节。 – Safy

相关问题