Issue
I have an app with flavorDimensions and productFlavors and I am customising the package name of Trial variants with the build.gradle script as follows:
defaultConfig {
applicationVariants.all { variant ->
def flavorString = variant.getVariantData().getVariantConfiguration().getFlavorName();
if(flavorString.endsWith("Trial")) {
def mergedFlavour = variant.getVariantData().getVariantConfiguration().getMergedFlavor();
mergedFlavour.setApplicationId(mergedFlavour.getApplicationId().concat("trial"))
}
}
}
Everything works fine but when I try to run my test cases against Trial variants I get the message:
Running tests
Test running startedFinish
Empty test suite.
I can run the tests against other variants perfectly, but I would like to know how to fix this situation.
Before anyone suggest to use applicationIdSuffix in buildType, I don't think that suits this case, I need to add a suffix to variants.
This is the build.gradle script for flavorDimensions and productFlavors:
flavorDimensions "merchant", "version"
productFlavors {
merchant1 {
flavorDimension "merchant"
applicationId "com.merchant1"
}
merchant2 {
flavorDimension "merchant"
applicationId "com.merchant2"
}
trial {
flavorDimension "version"
}
prod {
flavorDimension "version"
}
}
Solution
You can now set applicationIdSuffix for productFlavors:
android {
productFlavors {
free {
applicationIdSuffix = ".free"
}
prod {
}
}
}
Source: http://android-developers.blogspot.ie/2015/12/leveraging-product-flavors-in-android.html
Answered By - Gustavo
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.