You are here: Tools > Gradle Plugin for Genymotion > Handling flavors

Handling flavors

The Android Gradle plugin brings the product flavors in Android. The Gradle plugin also handles this flavor system.

If the Android Gradle plugin is added and flavors are declared, you can set specific virtual devices to be started during tests related to flavors.

In the following example, two flavors are defined in the build.gradle file:

android {
...
  productFlavors {
    flavor1 {
      applicationId "com.genymotion.binocle.flavor1"
      versionCode 20
    }
    flavor2 {
      applicationId "com.genymotion.binocle.flavor2"
      minSdkVersion 14
    }
  }
}

In the following example, three virtual devices are defined. device1 is declared without specifying a flavor. It is considered as common to all flavors and will be started for each of them.

Then, device2 will be launched for flavor1 and device3 will be launched for both flavors.

genymotion {
  devices {
    device1 {
      template "Google Nexus 5 - 4.4.4 - API 19 - 1080x1920"
    }
    device2 {
      template "Google Nexus 7 - 4.2.2 - API 17 - 800x1280"
      productFlavors "flavor1"
    }
    device3 {
      template "Google Nexus 10 - 4.3 - API 18 - 2560x1600"
      productFlavors "flavor1", "flavor2"
    }
  }
}