Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Attribute "barLength" has already been defined

I have just updated Material Design Support Lib to v23.0.1 and now, my code doesn't compile anymore.

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'.

What should I do?

EDIT:

The 2 libs that gives me the error are:

compile 'com.android.support:design:22.2.0'
compile 'com.android.support:appcompat-v7:22.2.0'
like image 834
Juliatzin Avatar asked Sep 07 '15 14:09

Juliatzin


3 Answers

Make sure you do not have any attribute named "barLength". In my case a custom ProgressWheel caused the issue, renamed attr name and problem resolved.

like image 112
Ekrem KENTER Avatar answered Oct 16 '22 17:10

Ekrem KENTER


The android:TextAppearance.Material.Widget.Button.Inverse and android:Widget.Material.Button.Colored error is due to you are still using Android Lollipop (API 21) compiler. Change your compileSdkVersion to 23.

Attribute "barLength" has already been defined error is due to your Gradle version is outdated. Go to Preference -> Build, Execution, Deployment -> Build Tools -> Gradle, change Gradle home to the latest Gradle version (Mine is gradle-2.4)

Remember to change your project build.gradle to use the following:

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

And also change your buildToolsVersion to 22.0.1.

Edit:

I noticed that you're using ProgressWheel library, created by Todd Davies. There is a conflict of declare-styleable, i.e. the barLength dimension. In that case you'll need to import Progress Wheel as a module in Android Studio and change the name of the attribute.

like image 37
Ken Tan Avatar answered Oct 16 '22 19:10

Ken Tan


Make sure you update your libraries that use the support library to use the same version as the project's support library

like image 1
Abdallah Alaraby Avatar answered Oct 16 '22 19:10

Abdallah Alaraby