Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attribute "primaryColor" has already been defined error #80

Closed
snorkel123 opened this issue Jan 18, 2015 · 12 comments
Closed

Attribute "primaryColor" has already been defined error #80

snorkel123 opened this issue Jan 18, 2015 · 12 comments

Comments

@snorkel123
Copy link

Alongside with MaterialEditText I use neokree/MaterialTabs. Both libs use "primaryColor" attribute.
Attribute "primaryColor" has already been defined occurs.

Possible solutions:

  1. Replace app:primaryColor with rengwuxian:primaryColor
  2. Or pick up primaryColor attr from theme declaration
@snorkel123 snorkel123 changed the title Attribute "primaryColor" has already been defined Attribute "primaryColor" has already been defined error Jan 20, 2015
@rengwuxian
Copy link
Owner

Ahhh. Sorry for that. I've no idea. Maybe I should pick a odder name for this attribute?

@marcusforsberg
Copy link

I also have this issue, which currently prevents me from using this library. I'd say option 2 is the way to go, simply taking the attribute from the theme. :)

@snorkel123
Copy link
Author

Possible way out is to search primaryColor specified, if there is none fallback to app:primaryColor

@saket
Copy link

saket commented Feb 7, 2015

This is a big issue and makes the library totally unusable on apps that use AppCompat.

@snorkel123
Copy link
Author

@rengwuxian Please don't PR, it solves issue in not the best way

@mdzeko
Copy link

mdzeko commented Feb 18, 2015

The same thing happens with Attribute "color" has already been defined. Probably because of the appcompat-v7 lib. Possible similar issue on https://github.com/neokree/MaterialTabs/issues/29

@lidemin
Copy link

lidemin commented Feb 19, 2015

Apparently the attr "primaryColor" has been defined in some libraries. I tried to fork the library and change that attr to something else which resolved this issue. Please consider to change its name . BTW the library is pretty awesome. Thanks.

@snorkel123
Copy link
Author

Issue should be solved by picking up "primaryColor" attribute from theme definition

@carstenhag
Copy link

👍 Still broken after 5 weeks :(

@rengwuxian
Copy link
Owner

Hi all,

Sorry for the delayed reply. MaterialEditText 2.0 is gonna be released in about 2 weeks. That will include some bug fixes and introduce a lot of customizations. About this issue, I decide to add a new attribute named like metPrimaryColor or something, and keep the standard primaryColor.

Some mentioned about retrieving the colorPrimary attribute. In fact, MaterialEditText does retrieve it: It tries to retrieve the android:colorPrimary on Lollipop devices, and fallback to the colorPrimary which is defined in the AppCompat series themes attribute if the OS version is below Lollipop or there's no android:colorPrimary attribute. However, retrieving android:colorPrimary or colorPrimary will just be a fallback, because there're some old themes that have neither android:colorPrimary nor colorPrimary.

Or if you have better solutions, let me know please.

Thanks!

@carstenhag
Copy link

neokree/MaterialTabs#38 Has been merged, so basically it half-way resolves this issue too. There just need to be a new release on their half, see https://github.com/neokree/MaterialTabs/issues/20


For people who can't wait for either project to release a new version:
Clone the MaterialTabs repo, import it in Android Studio via File > Import Module..., Click on your app folder in the Project Tab, press F4, select your app and add a Module dependency for MaterialTabsModule.

@rengwuxian
Copy link
Owner

Hi all,

2.0.3 has been released, introducing a unified prefix 'met_'

You can check the latest library version now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants