Question: I have been using gradle for creating different build variants for different companies for an Android app.

For example I have build flavors:

* Company1
* Company2

And then I have build types:

* Production
* Preview
* Development

So this will create 6 build variants:

* Company1Production
* Company1Preview
* Company1Development
* Company2Production
* Company2Preview
* Company2Development

So the question is:
Actually I don't need the development build type for company 2, I only need it for company 1. 

Is there a way I can specify only company 1 have the development build type?

I have a lot of companies in my projects, some of the build type just don't make sense for those companies, and it confuses people who want to build the app.

Answer: 
To answer my own question, I have found the documentation on the [Gradle Plugin User Guide](http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Sourcesets-and-Dependencies)

**Filtering Variants**

When you add dimensions and flavors, you can end up with variants that don't make sense. For example you may define a flavor that uses your Web API and a flavor that uses hard-coded fake data, for faster testing. The second flavor is only useful for development, but not in release builds. You can remove this variant using the variantFilter closure, like this:

```
android {
    productFlavors {
        realData
        fakeData
    }

    variantFilter { variant ->
        def names = variant.flavors*.name

        if (names.contains("fakeData") && variant.buildType.name == "release") {
            variant.ignore = true
        }
    }
}

```

With the configuration above, your project will have only three variants:

* realDataDebug
* realDataRelease
* fakeDataDebug
You can't stop the Android plugin from creating the matrix of all builds, but you can cause the build to fail if it's not valid. For example, if you don't want Flavor2 Debug builds to work, you can stop them like this:

```
afterEvaluate {
    tasks['prepareFlavor2DebugDependencies'].doFirst {
        throw new IllegalArgumentException("This project is not valid")
    }
}

```