I am trying to modify the gradle file to allow different names for my Flavor and Build Type based application. So far I have been successful in terms of Flavor using Manifest Merging methods using Android gradle Plugin Docs
Current
These are the application names on my home screen for my debug and release constructs.
Flavor Debug App Name Release App Name
Close it, but ...
Desired
Flavor Debug App Name Release App Name
I need this so that I know what taste of debug is on my home screen. I'm not interested in the differentiation of tastes release , as the user will have only one on his device (maybe he can have several, but this does not concern me)
Given how extensible gradle is, I assume this is possible; however, I am not an advanced gradle user.
So, how can I (as much as possible) extend my code to get the desired result?
Note: the above tables use versionNameSuffix as a suffix for my application name; however, it could be anything (another added variable ??), which will allow me to tell what taste I use only in my debug build style.
Non-goals
Code
android { compileSdkVersion 23 buildToolsVersion "23.0.2" defaultConfig { applicationId "..." minSdkVersion 17 targetSdkVersion 23 versionCode 1 versionName "1.0" manifestPlaceholders = [ applicationLabel:"App Name"] } productFlavors { entity_1 { versionNameSuffix ' - Entity_1_name' applicationIdSuffix 'entity_1' } entity_2 { versionNameSuffix ' - Entity_2_name' applicationIdSuffix 'entity_2' } hub { versionNameSuffix ' - Hub' applicationIdSuffix 'hub' manifestPlaceholders = [ applicationLabel:"Hub" ] } } buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } }
manifest
<manifest ...> <application ... android:label="${applicationLabel}" ... >
Update
android { compileSdkVersion 23 buildToolsVersion "23.0.2" ext { APP_NAME = "App Name" HUB_NAME = "Hub" } defaultConfig { applicationId "..." minSdkVersion 17 targetSdkVersion 23 versionCode 1 versionName "1.0" } productFlavors { one_million { versionNameSuffix ' - Entity_1' applicationIdSuffix 'entity_1' manifestPlaceholders = [ applicationLabel: APP_NAME + versionNameSuffix ] } udacity { versionNameSuffix ' - Entity_2' applicationIdSuffix 'entity_2' manifestPlaceholders = [ applicationLabel: APP_NAME + versionNameSuffix ] } hub { versionNameSuffix ' - Hub' applicationIdSuffix 'hub' manifestPlaceholders = [ applicationLabel: HUB_NAME ] } } buildTypes { release { manifestPlaceholders = [ applicationLabel: APP_NAME ] minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } }
New outlet
Flavor Debug App Name Release App Name