I have my android Project with five Product flavour as:
productFlavors {
'Dev' {
manifestPlaceholders = [appName: "Product"]
}
'Diamond' {
manifestPlaceholders = [appName: "Product-Diamond"]
applicationId GROUP.toString() + ".oc"
}
'Gold' {
manifestPlaceholders = [appName: "Product-Gold"]
applicationId GROUP.toString() + ".Gold"
}
'Silver' {
manifestPlaceholders = [appName: "Product-Silver"]
applicationId GROUP.toString() + ".Silver"
}
'Bronze' {
manifestPlaceholders = [appName: "Product-bronze"]
applicationId GROUP.toString() + ".bronze"
}
}
And I have one module name as premimum
, which I'm including to my main project using:
dependencies {
implementation project(path: ':premimum')
}
The problem I'm facing is, I just want to use this modulepremimum
, inside Dev
and Diamond
flavour, I want to add the premimum
dependency only for these two flavour, how can I do that.
My gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.binarybuff.appgo"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
flavorDimensions "default"
productFlavors {
Dev {
manifestPlaceholders = [appName: "Product"]
}
Diamond {
manifestPlaceholders = [appName: "Product-Diamond"]
applicationId "com.binarybuff.appgo" + ".oc"
}
Gold {
manifestPlaceholders = [appName: "Product-Gold"]
applicationId "com.binarybuff.appgo" + ".Gold"
}
Silver {
manifestPlaceholders = [appName: "Product-Silver"]
applicationId "com.binarybuff.appgo" + ".Silver"
}
Bronze {
manifestPlaceholders = [appName: "Product-bronze"]
applicationId "com.binarybuff.appgo" + ".bronze"
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
// implementation project(path: ':premium')
// DiamondImplementation project(":premium")
DiamondImplementation project(path: ':premium' )
}
I already look for this and found: Library Publication
Gradle: add dependency for a specific flavour of the library
I follow the above links but failed. please help.