It's not directly possible right now due to some issue in how we setup the
tasks and variants. This should be possible in the long term though.
Right now you could do something like this:
configurations {
freeFroyoCompile
}
dependencies {
freeFroyoCompile ...
}
android.applicationVariants.all { variant ->
if (variant is freeFroyo) {
variant.javaCompile.classpath += freeFroyoCompile.files
}
}
On Thu, Mar 27, 2014 at 7:37 AM, Croc <[email protected]> wrote:
> "froyoFreeCompile" is probably not recognized because I think you used the
> wrong order of flavors. The order should be the same as was declared in
> "flavorGroups", so it should actually be "freeFroyoCompile".
>
>
> On Saturday, March 22, 2014 8:06:49 PM UTC+1, Paweł Stankowski wrote:
>>
>> I have two flavor groups: "api" (froyo and gingerbread flavors) and
>> "variant" (free and pro flavors).
>>
>> How to add dependency only to one build variant, ie only for froyo-free
>> version? 'froyoFreeCompile' is not recognized by gradle (both freeCompile
>> and froyoCompile are working as expected). If this is not possible
>> directly, may I add such dependency using customized task?
>>
>> My build.gradle:
>>
>> ...
>> flavorGroups "variant", "api"
>>
>> productFlavors {
>> free {
>> flavorGroup "variant"
>> packageName "..."
>> }
>> pro {
>> flavorGroup "variant"
>> packageName "..."
>> }
>>
>> froyo {
>> flavorGroup "api"
>> minSdkVersion 8
>> }
>> gingerbread {
>> flavorGroup "api"
>> minSdkVersion 9
>> }
>> }
>> }
>>
>> dependencies {
>> freeFroyoCompile files(getSdkDir() + '/extras/google/admob_ads_sdk/
>> GoogleAdMobAdsSdk-6.4.1.jar')
>> freeGingerbreadCompile 'com.google.android.gms:play-services:+'
>> }
>>
>> ...
>>
> --
> 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.