1

I have a project that is currently using ActionBarSherlock, Crouton, and UnifiedPreference which works (compiles, runs without issue on devices and emulator for Android 2.3.3+). I want to add HoloEverywhere so that I can keep a unified interface when it runs on Gingerbread devices. Once I added HoloEverywhere to the mix I get the following AAPT errors:

[2012-12-14 12:47:04 - MyApp] C:\git\myrepo\UnifiedPreference\library\res\values\atrs.xml:7: error: Attribute "id" has already been defined
[2012-12-14 12:47:04 - MyApp] C:\git\myrepo\UnifiedPreference\library\res\values\atrs.xml:11: error: Attribute "summary" has already been defined
[2012-12-14 12:47:04 - MyApp] C:\git\myrepo\UnifiedPreference\library\res\values\atrs.xml:13: error: Attribute "breadCrumbTitle" has already been defined
[2012-12-14 12:47:04 - MyApp] C:\git\myrepo\UnifiedPreference\library\res\values\atrs.xml:15: error: Attribute "breadCrumbShortTitle" has already been defined
[2012-12-14 12:47:04 - MyApp] C:\git\myrepo\UnifiedPreference\library\res\values\atrs.xml:19: error: Attribute "fragment" has already been defined

The AAPT errors reference whichever library project is first (either UnifiedPreference OR HoloEverywhere) in my android library dependency list. I've also discovered that all of the offending attributes are defined as part of <declare-styleable name="PreferenceHeader"> My current Android Dependency order and structure is:

MyApp
   ActionBarSherlock
   HoloEverywhere
   UnifiedPreference
   Crouton
HoloEverywhere
   ActionBarSherlock
UnifiedPreference
   ActionBarSherlock
Crouton

I have tried changing the order of HoloEverywhere and UnifiedPreference, removing ActionBarSherlock from one and making it dependent on the other, and tried pulling them down from git again.

Does anyone know how to get UnifiedPreference and HoloEverywhere to play nicely together since they both have attributes with the same name?

1 Answers1

2

Yeah, you're gonna have to rename some attributes to get rid of that AAPT problem. Once the resources get merged into your project, you can't have attributes with the same name. If in reality these are duplicate attributes (meaning, ones that happened to been defined from scratch in its respective project and actually identical to the other), then simply delete them leave in the highest dependency that contains those and delete them from the lower ones.

LuxuryMode
  • 33,401
  • 34
  • 117
  • 188
  • I haven't added any custom attributes that conflict in my project, and was hoping to not have to edit the library code. With that said I did try removing the xml definitions from one project and changing the dependency order. When I did this I was getting build errors in the project where it was removed even though one of it's dependencies included those Attributes. – Mike Schreiner Dec 14 '12 at 21:53
  • If I understand it correctly, your app depends on ABs, HE, UP and Crouton? And HE depends on ABS and UP depends on ABS? I think the problem is that you need to only have the highest dependency depend on ABS and then make sure its dependency (namely ABS) be exported. Otherwise you're using ABS 3 times. Does that make sense? – LuxuryMode Dec 16 '12 at 17:11
  • @nissemand I was unable to get this working after trying the solution described above and messing around with it for a few days. I eventually dropped HoloEverywhere but kept UnifiedPreference. I haven't tried using it yet, however I wonder if things will work better with the new ActionBar support library implementation instead of ABS. – Mike Schreiner Oct 23 '13 at 12:17
  • @MikeS., cheers for the response! I eventually got HoloEverywhere to work with ABS following [this answer](http://stackoverflow.com/a/10888882/1438809). – Felix Oct 23 '13 at 21:18