I am creating an application that should have two flavors, netball and football. When I set up my project as per https://developer.android.com/tools/building/configuring-gradle.html only one of the flavors are being recognized i.e netball and other flavor's package i.e football is not.
This is my build.gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "net.brawtasports.brawtasportsgps"
minSdkVersion 11
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
netball {
applicationId "net.brawtasports.brawtasportsgps.netball"
versionName "1.0"
}
football {
applicationId "net.brawtasports.brawtasportsgps.football"
versionName "1.0"
}
}
sourceSets {
main {
java.srcDirs = ['src/main/java']
res.srcDirs = ['src/main/res']
}
football {
java.srcDirs = ['src/football/java']
res.srcDirs = ['src/football/res']
}
netball {
java.srcDirs = ['src/netball/java']
res.srcDirs = ['src/netball/res']
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.android.support:recyclerview-v7:22.2.0'
compile 'com.vstechlab.easyfonts:easyfonts:1.0.0'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.squareup.okhttp:okhttp:2.2.0'
compile 'com.squareup.picasso:picasso:2.5.2'
}
I realize that is is only recognizing the first item in productFlavors i.e netball. if I place football first it will recognize football and not netball. What is wrong?????
You also need to select your current flavour on the panel Build variants
to the left of the IDE window.