2015-09-07 102 views
12

我剛將Material Design Support Lib更新爲v23.0.1,現在我的代碼不再編譯。屬性「barLength」已被定義

Attribute "barLength" has already been defined 
/Users/admin/Documents/workspace/MyApp/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.0.1/res/values-v23/values-v23.xml 
Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'. 
Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'. 

我該怎麼辦?

編輯:

的2個庫,讓我的錯誤是:

compile 'com.android.support:design:22.2.0' 
compile 'com.android.support:appcompat-v7:22.2.0' 

回答

25

確保您沒有任何名爲「barLength」的屬性。在我的情況下,自定義的ProgressWheel導致了這個問題,重命名了attr名稱並解決了問題。

+0

Thanks.I也有我的自定義進度wheellength.After我重命名後,問題解決。謝謝 – YeeKhin

+0

這是問題tx –

+0

可能需要檢查attr.xml,我與自定義ProgressBar有相同的問題 – HK1988

1

請確保您更新使用支持庫使用相同的版本作爲該項目的支持庫的庫

+0

我怎樣才能做到這一點?我認爲衝突是一個lib,使用:progressWheel:https://github.com/Todd-Davies/ProgressWheel,但我不知道如何修改它,因爲它包含在Gradle –

+0

我認爲這可能不是真正。我剛剛檢查了你提到的庫,發現它不依賴於支持庫。無論如何,如果問題出在您通過gradle使用的某個庫上,您可以將該庫作爲Android Studio中的一個模塊(或者在您使用Eclipse的情況下作爲庫)添加,並手動修改它的依賴關係。 –

11

android:TextAppearance.Material.Widget.Button.Inverseandroid:Widget.Material.Button.Colored錯誤是由於您仍在使用Android Lollipop(API 21)編譯器。將您的compileSdkVersion更改爲23.

Attribute "barLength" has already been defined錯誤是由於您的Gradle版本已過時。轉到Preference - >Build, Execution, Deployment - >Build Tools - >Gradle,改變Gradle home最新的搖籃版本(我的是gradle-2.4

記住要改變你的項目build.gradle使用如下:

dependencies { 
    classpath 'com.android.tools.build:gradle:1.4.0' 
} 

,改變您的buildToolsVersion22.0.1

編輯:

我注意到您使用ProgressWheel庫,由託德·戴維斯創建。存在衝突declare-styleable,即barLength維度。在這種情況下,您需要將Progress Wheel作爲Android Studio中的模塊導入並更改屬性的名稱。

+0

Gradle 1.4尚未發佈https://jcenter.bintray.com/com/android/tools/build/gradle/ – Ricardo

+0

@Ricardo最新版本是Gradle 1.4 beta 6,我正在使用那個。 –

+0

謝謝,這對我有幫助。我的模塊中有ProgressWheel--瘋狂的令人憤怒的是,我發現衝突花了那麼長時間,沒有告訴我它最初是在哪裏定義的,只是第二次定義它的位置。 歡迎您的幫助! – Mullazman

0

buildToolsVersion 21 targetSdkVersion 「22.0.1」