Android Gradle - Add packageNameSuffix on specific productFlavor
android, android-gradle-plugin, gradle
Solution
This is not possible at the moment. packageNameSuffix is strictly a property of Build Type.
I'd like to offer a way to customize the ProductFlavor's values for a given variant (ie a given combination of all flavor dimensions and of build type) but it's not possible at the moment.
Instead of a new dimension of flavor, you could do a "amzRelease" buildtype that extends the existing release buildtype and add a suffix.
If your current "amazon" flavor does more (configure versionCode/Name/etc...), it won't work though. You could then use both your amazon flavor and a amzRelease build type. It'll create a lot more variants than you need but it'd work until we have some better.
Problem
I have a Gradle Android Project with this product Groups and Flavors configuration: ``` /* * Define different flavor groups */ flavorGroups 'market', 'version' /* * Defile product flavors */ productFlavors { amazon { flavorGroup 'market' } google { flavorGroup 'market' } flav1 { flavorGroup 'version' packageName 'com.company.flav1' } flav2 { flavorGroup 'version' packageName 'com.company.flav2' } flav3 { flavorGroup 'version' packageName 'com.company.flav3' } } // .. Other stuff ``` It works great. All sources and resources are merged correctly. But for specific reasons I need the package suffix to be `.amz` for the `amazon` product flavor. How can I achieve that? I tried this way: ``` amazon { flavorGroup 'market' packageNameSuffix '.amz' } ``` but `gradle` throws an exception.