Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Application Id based on build type

I need to change full application Id based on build type not adding a suffix after Id. I have tried to move applicationId inside each build type but Gradle uses the last one in the last build type by default. Is that possible?

like image 612
Mohamed Khalifa Avatar asked Mar 28 '26 06:03

Mohamed Khalifa


1 Answers

You can use gradle filter to ignore some build/flavor targets.
Check the following code:

variantFilter { variant ->
   def flavor = variant.flavors*.name
   def buildType = variant.buildType*.name

   // To check for a certain build type, use variant.buildType.name == "<buildType>"
   if ((flavor.contains("xyz") && buildType.contains("debug"))) {
       // Gradle ignores any variants that satisfy the conditions above.
       setIgnore(true)
   }
}
like image 164
Melad Avatar answered Mar 29 '26 20:03

Melad



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!