Test package for different flavors in Android Studio Test package for different flavors in Android Studio android android

Test package for different flavors in Android Studio


From the documentation

Testing multi-flavors project is very similar to simpler projects.

The androidTest sourceset is used for common tests across all flavors, while each flavor can also have its own tests.

As mentioned above, sourceSets to test each flavor are created:

  • android.sourceSets.androidTestFlavor1
  • android.sourceSets.androidTestFlavor2

So, just as you should have now 'free' and 'paid' folders with code specific for each flavor, you can add 'androidTestFree' and 'androidTestPaid' folders where you you can add test cases specific to each one of your flavors.


This is really what did it for me: How to specify unit test folder in two-dimension flavor

dependencies {  androidTestFlavor1Compile "..."  //In your case androidTestStbAppleCompile         }