The variant filter only indicates whether the variant will be created. It
should not impact modifying the variant itself.

You can provide you build.gradle so that we can look at it? We only need
the variantFilter closure and the applicationVariants.all closure.


On Thu, Mar 20, 2014 at 6:42 AM, <[email protected]> wrote:

> Hi Diego,
>
> Thanks, i got the version name, v.code and flavour with variantFilter.
> Also, earlier i user like
>
>      def oldFile = variant.packageApplication.outputFile;
>      def newFile =  appName + "-" + variant.name + "-v" +
> variant.config.versionName + ".apk" ( this will change with the new values
> as per variantFilter)
>      variant.packageApplication.outputFile = new File(oldFile.parent,
> newFile)
>
> But now i am unable to get the .outputFile  with new variantFilter.
> Could you please suggest me a solution for this ?
>
> On Wednesday, 12 March 2014 15:53:21 UTC+5:30, Diego Costantini wrote:
>>
>> Hi Xavier,
>> thanks for the suggestion, but when I apply it and sync gradle, it gets
>> stuck on Resolve dependencies 'detachedConfiguration1' and I need to
>> restart AS.
>>
>> BTW: is there a less painful way to stop (hanging) operations in AS?
>>
>> On Tuesday, March 11, 2014 6:32:42 PM UTC+1, Xavier Ducrohet wrote:
>>>
>>> ah yes of course. defaultConfig is the same for all variants. I put it
>>> in there but it really is not needed since you have access to it through
>>> the global project object. I should just remove it.
>>>
>>> For the flavors, you don't need to loop really. The number of flavors is
>>> the same as the number of flavor groups you have. so you could just do
>>>
>>> if (*variant.getFlavors().get(0).name* != "flavorA" && type ==
>>> "debugFlavorAQA")
>>>
>>>
>>> On Tue, Mar 11, 2014 at 9:51 AM, Diego Costantini <[email protected]
>>> > wrote:
>>>
>>>> solved the following way :)
>>>>
>>>>     variantFilter { variant ->
>>>>         type = variant.getBuildType().name
>>>>         variant.getFlavors().each { flavor ->
>>>>             if (flavor.name != "flavorA" && type == "debugFlavorAQA") {
>>>>                 variant.setIgnore(true)
>>>>
>>>>             }
>>>>         }
>>>>     }
>>>>
>>>> On Tuesday, March 11, 2014 12:18:35 PM UTC+1, Diego Costantini wrote:
>>>>>
>>>>> Hi guys,
>>>>> in latest plugin we can use variantFilter.
>>>>>
>>>>> I am not sure I am using it wrong or there is a bug.
>>>>>
>>>>>     variantFilter { variant ->
>>>>>         flavor = variant.getDefaultConfig().
>>>>> versionName
>>>>>         println "flavor $flavor"
>>>>>         type = variant.getBuildType().name
>>>>>         println "type $type"
>>>>>         if (flavor == "vanilla" && type == "release") {
>>>>>             variant.setIgnore(true)
>>>>>         }
>>>>>     }
>>>>>
>>>>> I am not sure I should use getDefaultconfig() because I always get
>>>>> vanilla rather than each flavor.
>>>>> Build types are looped correctly instead.
>>>>>
>>>>> 3 flavors and 3 types (I expect 9 couples but there are 8), this is
>>>>> the output:
>>>>> flavor vanilla
>>>>> type debug
>>>>>
>>>>> flavor vanilla
>>>>> type release
>>>>>
>>>>> flavor vanilla
>>>>> type debugQA
>>>>>
>>>>> flavor vanilla
>>>>> type debug
>>>>>
>>>>> flavor vanilla
>>>>> type release
>>>>>
>>>>> flavor vanilla
>>>>> type debugQA
>>>>>
>>>>> flavor vanilla
>>>>> type debug
>>>>>
>>>>> flavor vanilla
>>>>> type release
>>>>>
>>>>  --
>>>> 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.
>



-- 
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