Last active
September 11, 2018 07:42
-
-
Save zawadz88/82b8ccbd7c4d3915ae6b4021bfe1c2f6 to your computer and use it in GitHub Desktop.
Shared flavor config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ext.flavorConfig = { // 1 | |
| flavorDimensions "pricing" | |
| productFlavors { | |
| free { | |
| dimension "pricing" | |
| ext.myApplicationIdSuffix = '.free' // 2 | |
| } | |
| paid { | |
| dimension "pricing" | |
| ext.myApplicationIdSuffix = '.paid' | |
| } | |
| } | |
| productFlavors.all { flavor -> // 3 | |
| if (flavor.hasProperty('myApplicationIdSuffix') && isApplicationProject()) { | |
| flavor.applicationIdSuffix = flavor.myApplicationIdSuffix | |
| } | |
| } | |
| } | |
| def isApplicationProject() { // 4 | |
| return project.android.class.simpleName.startsWith('BaseAppModuleExtension') | |
| // in AGP 3.1.x with library modules instead of feature modules: | |
| // return project.android instanceof com.android.build.gradle.AppExtension | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment