Profiles - NBANDROIDTEAM/NBANDROID-V2 GitHub Wiki
The name of the active NB profile is passed as Gradle command line property.
-Pandroid.profile=profile_name
This feature can be used for multi-branding of your android application.
Some examples:
Change build config variable STATUS_BAR_COLOR by profile
if (project.hasProperty('android.profile') && project.getProperty('android.profile') == 'PROFILE1') {
buildConfigField "String", "STATUS_BAR_COLOR", "\"#5f5f5f\""
}else if (project.hasProperty('android.profile') && project.getProperty('android.profile') == 'PROFILE2'){
buildConfigField "String", "STATUS_BAR_COLOR", "\"#000000\""
}
Change resource folder by profile
if (project.hasProperty('android.profile') && project.getProperty('android.profile') == 'PROFILE1') {
sourceSets
{
main
{
res.srcDirs =
[
'src/main/Profile1Res'
]
}
}
}else if (project.hasProperty('android.profile') && project.getProperty('android.profile') == 'PROFILE2'){
sourceSets
{
main
{
res.srcDirs =
[
'src/main/Profile2Res'
]
}
}
}else{ //to show all res folders in project tree
sourceSets
{
main
{
res.srcDirs =
[
'src/main/res', //default res folder
'src/main/Profile1Res',
'src/main/Profile2Res'
]
}
}
}