To follow up on this idea, what is the expected behavior with a config like 
the following?

app depends on: A, B
B depends on: A

The gradle doc states "The priority of the merge order from lowest to 
highest is libraries/dependencies -> main src -> productFlavor -> 
buildType." From the perspective of module B, its resources should take 
precedence over those in A (since A is a dependency). However, from the 
perspective of the app module, A appears before B, so A should take 
precedence.

In practice, we have some evidence that the behavior is not easy to 
predict. Some seemingly unrelated change in B caused it take priority, when 
A had priority prior to the change.


On Friday, August 8, 2014 at 4:57:15 PM UTC-7, James Wald wrote:
>
> Huh okay, good to know. I never realized the order of project dependencies 
> had this effect back in the Ant days either. Thanks again!
>
> On Friday, August 8, 2014 1:44:55 PM UTC-10, Xavier Ducrohet wrote:
>>
>> This is working as intended (it worked like this in Ant/ADT as well).
>>
>> We need to add diagnostic tools to let you devs understand exactly what's 
>> going on.
>>
>>
>> On Fri, Aug 8, 2014 at 4:24 PM, James Wald <[email protected]> wrote:
>>
>>> I have a multi-project build that is structured like this:
>>>
>>> root/
>>>     app/
>>>         build.gradle -> dependencies: libA, libB
>>>     libA/
>>>         src/main/res
>>>             styles.xml -> @style/AppTheme
>>>         build.gradle
>>>     libB/
>>>         src/main/res
>>>             styles.xml -> @style/AppTheme
>>>         build.gradle
>>>
>>> When declaring app's dependencies, these produce different resources 
>>> after the merge process:
>>>
>>> dependencies {
>>>     compile project(':libA')
>>>     compile project(':libB')
>>> }
>>>
>>> dependencies {
>>>     compile project(':libB')
>>>     compile project(':libA')
>>> }
>>>
>>> The library that is declared first in the dependencies block wins and 
>>> the other library's @style/AppTheme resource is ignored. Since the 
>>> libraries both declare @style/AppTheme and do not depend on each other, I 
>>> was expecting the build to fail with a resource merging conflict. I'm 
>>> wondering whether this is a bug or working as intended?
>>>  
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "adt-dev" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to [email protected].
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> -- 
>> Xavier Ducrohet
>> Android SDK Tech Lead
>> Google Inc.
>> http://developer.android.com | http://tools.android.com
>>
>> Please do not send me questions directly. Thanks! 
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"adt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to