That makes sense, I'll try the buildTypes/VariantFilter way. Thank you, 
Xavier!

Olivier

Le mardi 7 juillet 2015 22:58:39 UTC+2, Xavier Ducrohet a écrit :
>
> Currently you cannot do this easily.
>
> SigningConfig are only associated with build types or flavors, not 
> variants.
>
> when you write:
>     buildTypes {
>         debug {
>             signingConfig null
>             productFlavors.flavor1.signingConfig signingConfigs.debug
>             productFlavors.flavor2.signingConfig signingConfigs.signatureB
>
>             ///
>         }
>
>
> it doesn't do what you think it does.
> if productFlavors is not found in the current scope ("debug" or 
> "buildtypes"), it goes up the scopes to find one. So the above is the same 
> as
>
>     buildTypes {
>         debug {
>             signingConfig null
>         }
>     }
>     productFlavors {
>         flavor1 {
>             signingConfig signingConfigs.debug
>         }
>
>         flavor2 {
>             signingConfig signingConfigs.signatureB
>         }
>     }
>
> Which means that all "flavor1" (no matter the build type will be signed 
> with debug.
>
> The only way to do this is to create 4 different build types: debug 
> (signingConfig.debug), releaseA (signing A), debugB (signingB), and release 
> (signing null0 to match your 4 signing config, and then you use 
> VariantFilter to only create the combo you want (for instance you do want 
> flavor1-debug but you don't want flavor1-debugB)
>
>
> On Tue, Jul 7, 2015 at 9:26 AM, Olivier Dennemont <[email protected] 
> <javascript:>> wrote:
>
>> Hello,
>>
>> The project I'm working on requires having a different signature for each 
>> variant:
>>
>> - flavor1Debug: default ("~/.android/debug.keystore")
>> - flavor1Release: signatureA
>> - flavor2Debug: signatureB
>> - flavor2Release: null (no signing, will be resigned by a third party)
>>
>> I realize this is not a common pattern, but would really appreciate some 
>> help. I was able to find useful information in this forum on how to set 
>> per-flavor signingConfig, but could not achieve the per-variant 
>> configuration above.
>>
>> The code below doesn't work, because the release block overrides the 
>> settings in the debug block:
>>
>>     signingConfigs {
>>         signatureA { 
>>             ///
>>         }
>>         signatureB {
>>             ///
>>         }
>>     }
>>
>>     productFlavors {
>>         flavor1 {
>>             ///
>>         }
>>
>>         flavor2 {
>>             ///
>>         }
>>     }
>>
>>     buildTypes {
>>         debug {
>>             signingConfig null
>>             productFlavors.flavor1.signingConfig signingConfigs.debug
>>             productFlavors.flavor2.signingConfig signingConfigs.
>> signatureB
>>
>>             ///
>>         }
>>
>>         release {
>>             productFlavors.flavor1.signingConfig signingConfigs.
>> signatureA
>>             productFlavors.flavor2.signingConfig null
>>
>>             ///
>>         }
>>     }
>>
>> Thanks,
>>
>> Olivier
>>
>> -- 
>> 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/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