Hi Xavier,

I see this issue has been fixed, but it's reoccurring for me, which I think 
is due to trying to modify the packagingOptions as well as 
applicationVariants.

I'm guessing calling the packagingOptions also forces creating the tasks? 

I'm trying to call applicationVariants.all after packagingOptions but am 
getting the same error:

Android tasks have already been created.
  This happens when calling android.applicationVariants,
  android.libraryVariants or android.testVariants.
  Once these methods are called, it is not possible to
  continue configuring the model.


Can you suggest any work arounds for this?


On Wednesday, 31 July 2013 05:57:23 UTC+12, Xavier Ducrohet wrote:
>
> yes .all will only work right when I stop forcing the creation of the 
> tasks when accessing the android.applicationVariants container.
>
>
> On Mon, Jul 29, 2013 at 11:19 PM, Peter Fortuin <[email protected] 
> <javascript:>> wrote:
>
>> You are right that my solution is very ugly. 
>> I'm using the .all instead of the .each, but I have the same problem. But 
>> as I understand you correctly you are going to make a fix for this?
>>
>>
>>
>>
>> 2013/7/30 Xavier Ducrohet <[email protected] <javascript:>>
>>
>>> While you can defer the apply plugin, it's kind of ugly.
>>>
>>> Right now calling android.applicationVariant force creating the tasks. 
>>> It really shouldn't and we should fix this.
>>>
>>> What this will do though, it prevent using 
>>> android.applicationVariant.each in most cases since when you are calling 
>>> this in your custom plugin (or after the android {} block) the variants and 
>>> their tasks won't have been generated.
>>>
>>> The trick will be to use .all instead of .each.
>>>
>>> .all applies the closure to all existing items in the collections right 
>>> away, and then automatically applies it whenever a new item is added.
>>>
>>>
>>> On Mon, Jul 29, 2013 at 2:28 AM, Thomas Bruyelle <[email protected] 
>>> <javascript:>> wrote:
>>>
>>>> Thanks a lot Peter, it works !
>>>> Don't know very well Gradle but it seems weird to impose to put the 
>>>> `apply plugin` after the android block. So interested also in a better 
>>>> solution.
>>>>  
>>>> -- 
>>>> 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] <javascript:>.
>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>  
>>>>  
>>>>
>>>
>>>
>>>
>>> -- 
>>> 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] <javascript:>.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>  
>>>  
>>>
>>
>>  -- 
>> 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] <javascript:>.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>
>
> -- 
> 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