Calin
Calin

Reputation: 6867

How do I run androidTest with product flavour enabled in Android Studio

I have the following product flavours and build types in my gradle file:

flavorDimensions "market"

productFlavors {
    amazon {
        dimension "market"
    }
    google {
        dimension "market"
    }
}

buildTypes {
    debug {
    }

    qa2 {
    }

    beta {
    }

    release {
    }
}

As expected my directory structure looks like:

Project structure

My problem is that when I hit run on androidTest in Android Studio 2.3.2 it will simply error out with

Class not found: "SomeClass" Empty test suite.

Upvotes: 0

Views: 583

Answers (2)

Calin
Calin

Reputation: 6867

The way I solved it was to postfix the androidTest with one of the flavor, let's say Google and changed the build variant to GoogleDebug

Structure that works

Upvotes: 0

Diego Torres Milano
Diego Torres Milano

Reputation: 69388

Currently, only one Build Type is tested. By default, it is the debug Build Type, but this can be reconfigured with:

android {
    ...
    testBuildType "beta"
}

See more details at http://tools.android.com/tech-docs/new-build-system/user-guide

Upvotes: 2

Related Questions