vendredi 10 mars 2017

Failure when using com.android.test plugin with multiple variants

I am using a separate module for testing using the com.android.test plugin. This all works fine if I hard code the android.targetVariant field to a known variant in my app being tested. What I would like to do is to specify some variants in my test module and then set the android.targetVariant field appropriately. I get the error "Cannot add a configuration with name 'testTarget' as a configuration with that name already exists." under two circumstances: i, specify any buildType other than debug; ii, specify more than option for a flavor dimension. If I only specify debug as a buildType and only specify a single option for each flavor dimension and hardcode the android.targetVariant field, it all still works. The task namess take account of the flavors and buildType but android.applicationVariants is not populated. What I would like to do is have multiple buildTypes and multiple options for each flavor dimension and then set android.targetVariant appropriately by traversing android.applicationVariants. Is this a possible usage for the com.android.test plugin? The documentation would suggest it is. If so, what is I need to do to allow multiple variants? If not, the documentation is very misleading.

Aucun commentaire:

Enregistrer un commentaire