2016-03-06 175 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

相關問題