It will not work with aar dependencies because you also have to inject the
dependencies in the manifest merger, the resource merger, etc...

I'm investigating a way to make it work though.

On Fri, Nov 14, 2014 at 4:00 PM, Matt Keener <[email protected]>
wrote:

> I've been attempting to manipulate my compiled dependences based on flavor
> combinations as referenced in this thread :
> https://groups.google.com/forum/#!topic/adt-dev/JRUksl4XpWk
>
> Everything appears to be working correctly, however I've noticed that
> Xavier mentioned that this functionality will not work with aar
> dependencies - this was back in April and I was curious if this has been
> addressed, and if so in what version of gradle?  If not, is there now a
> work around for this? I have yet to be able to find one.
>
> This is how I've implemented the dependency fix for reference:
>
> configurations{
>     flavor1FlavorACompile
>     flavor2FlavorACompile
> }
>
> dependencies {
>     compile project(':aar-dependency1')
>     flavorACompile fileTree(dir: 'libs', include: '*.jar')
>     flavorBCompile fileTree(dir: 'libs', include: '*.jar', exclude:
> 'supportLibrary.jar')
>     flavor1FlavorBCompile project(':aar-dependency2')
>     flavor2FlavorBCompile project(':aar-dependency3')
> }
>
> task fixDependencies << {
>     android.applicationVariants.all { variant ->
>         def flavors = variant.productFlavors;
>
>         if (flavors.contains(Flavor1) && flavors.contains(FlavorA)) {
>             variant.javaCompile.classpath +=
> configurations.flavor1FlavorACompile
>         } else if (flavors.contains(Flavor2) && flavors.contains(FlavorA))
> {
>             variant.javaCompile.classpath +=
> configurations.flavor2FlavorACompile
>         }
>     }
> }
>
> tasks.whenTaskAdded { theTask ->
>     if (theTask.name.startsWith("compile")) {
>         theTask.dependsOn "fixDependencies"
>     }
> }
>
> Thanks!
> Matt Keener
>
> --
> 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