Hi,

change 'Ginger' to 'ginger' and 'Froyo' to 'froyo' in both productFlavors{} 
and dependencies{} sections. 
Then everything would be ok.

M.

W dniu poniedziałek, 5 maja 2014 18:33:36 UTC+2 użytkownik Stefano IceCubeR 
napisał:
>
> I'm new to gradle, i'm trying to build 2 flavor, 
> Froyo - 2.2 only and 
> GringerBreadPlus - 2.3 and newer
>
> in myProject\MyApp\build.gradle i try this:
>
>     productFlavors {
>         GringerBreadPlus {
>                    minSdkVersion 9
>         }
>          Froyo{
>              minSdkVersion 8
>         }
>     }
>
>
> dependencies {
>     compile project(':ckChangeLogmaster')
>     compile project(':appirater')
>     compile 'com.android.support:support-v4:+'
>     compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
>     //compile 'com.google.android.gms:play-services:+'
>     GringerBreadPlusCompile 'com.google.android.gms:play-services:+'
>     //FroyoCompile 'com.google.android.gms:play-services:3.2.+'
> ...
> }
>
> > startup failed:
>   build file 
> 'C:\Users\sgirotti\AndroidStudio\aJobSearch\aJobSearch\build.gradle
> ': 54: unexpected token: com.google.android.gms:play-services:+ @ line 54, 
> colum
> n 26.
>         GringerBreadPlusCompile 'com.google.android.gms:play-services:+'
>                               ^
>
> i don't understand.... i try to import from eclipse with the latest 
> Studio.... i also tryed to define productFlavors & dependencies on
>
> myProject\build.gradle
>
> what's wrong?!
>
> Thanks in advance
>
> On Thursday, April 3, 2014 10:21:41 PM UTC+2, Paweł Stankowski wrote:
>>
>>  I found some workaround, which I described here:
>>
>> http://stackoverflow.com/questions/22313632/multi-flavor-compile-dependencies-in-gradle
>>
>> Generally I parse start task (eg. "assembleFreeFroyoDebug") given to 
>> gradle and check what flavours are specified. I store flavours in global 
>> variables and use them in following way:
>>
>> def getAdmobDependency() {
>>   return  groupFlavor == "Froyo" ? files(getSdkDir() + 
>> '/extras/google/admob_ads_sdk/GoogleAdMobAdsSdk-6.4.1.jar') : 
>> 'com.google.android.gms:play-services:+'
>> }
>>
>> [...]
>>
>> dependencies{
>>   freeCompile getAdmobDependency()
>> }
>>
>> W dniu 2014-04-03 01:08, Xavier Ducrohet pisze:
>>  
>> Yes this is only going to work for jar dependencies. If you have an aar 
>> dependency, it's not going to work. 
>>
>>  We're going to allow this but there's some work that needs to happen 
>> first before we can make progress on this.
>>  
>>
>> On Wed, Apr 2, 2014 at 2:01 PM, Paweł Stankowski <[email protected]>wrote:
>>
>>>  You're right Croc, I made a mistake in problem's description - it 
>>> should be "freeFroyoCompile". However, I wrote it correctly in my gradle 
>>> script.
>>>
>>>  Thank you Xavier, it almost work for me. Your example was not 
>>> compiling, but I did my best to use your idea. 
>>>
>>>  The code is below. Now I can compile for Froyo, but not for 
>>> Gingerbread because resources from dependency are not accessible:
>>> ".../build/manifests/freegingerbread/debug/AndroidManifest.xml:40: 
>>> error: Error: No resource found that matches the given name (at 'value' 
>>> with value '@integer/google_play_services_version')."
>>>
>>>  When I run froyo version compiled with this script, admob jar seems 
>>> not to be attached:
>>> "E/dalvikvm﹕ Could not find class 'com.google.ads.AdView', referenced 
>>> from method pl.aambitny.spellscontainer.view.common.AdUtils.reloadAd"
>>>
>>>  task fixDependencies << {
>>>     def freeFlavor = android.productFlavors.free;
>>>     def froyoFlavor = android.productFlavors.froyo;
>>>     def gingerbreadFlavor = android.productFlavors.gingerbread;
>>>
>>>      android.applicationVariants.all { variant ->
>>>         def flavors = variant.productFlavors;
>>>         if (flavors.contains(freeFlavor) && 
>>> flavors.contains(froyoFlavor)) {
>>>             variant.javaCompile.classpath += 
>>> configurations.freeFroyoCompile;
>>>         } else if (flavors.contains(freeFlavor) && 
>>> flavors.contains(gingerbreadFlavor)) {
>>>             variant.javaCompile.classpath += 
>>> configurations.freeGingerbreadCompile
>>>         }
>>>     }
>>> }
>>>
>>>  tasks.whenTaskAdded { theTask ->
>>>     if (theTask.name.startsWith("compile")) {
>>>         theTask.dependsOn "fixDependencies"
>>>      }
>>> }
>>>
>>> On Thursday, March 27, 2014 4:34:43 PM UTC+1, Xavier Ducrohet wrote:
>>>
>>>>  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.
>>>  
>>  
>>
>>
>>  -- 
>> 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 a topic in the 
>> Google Groups "adt-dev" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/adt-dev/JRUksl4XpWk/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> [email protected].
>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>> 

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