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?

4

1 回答 1

2

是的,你将不得不重命名一些属性来摆脱那个 AAPT 问题。一旦资源合并到您的项目中,您就不能拥有同名的属性。如果实际上这些是重复的属性(意思是那些碰巧在其各自的项目中从头开始定义并且实际上与另一个相同的属性),那么只需将它们删除并保留在包含这些属性的最高依赖项中并从较低的依赖项中删除它们。

于 2012-12-14T18:26:44.180 回答