This time I have this problem, I am trying to get the current flavor in a gradle script. I have tried the answers given here How to get current flavor in gradle without luck.
I haven seen in some answers that they use
// Get all flavors
android.productFlavors.all { flavor ->
if (flavor.name.equals("flavorName")) {
// do what you like
}
// ...
}
But also I didn't have any luck with that because i get the following error: > Could not get unknown property 'android' for task
So I don't know how to get the current flavor, any help will be very appreciated thanks!!!
EDIT: What I need to do is to execute a piece of code that is diferent for each flavor, my current idea is to know the selected build variant to do this in a task, but if there is any othe way to do this would be perfect.