'How to apply differenct plugins for different product flavors in gradle?
I've two product flavors in my Android project like:
productFlavors: {
flavor1 {
...
}
flavor2 {
...
}
}
I want to apply plugin based on productFlavors like this:
if (flavor1 Build Variant) {
apply plugin: 'com.android.application'
} else {
apply plugin: 'com.android.library'
}
I tried this:
def isFlavor1= getGradle().getStartParameter().getTaskRequests().toString().toLowerCase().contains('flavor1')
if (isFlavor1) {
apply plugin: 'com.android.application'
} else {
apply plugin: 'com.android.library'
}
But this doesn't solve the problem.
So, how can I apply plugin based on productFlavors?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
