Gradle for product flavor
Clash Royale CLAN TAG#URR8PPP
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;
up vote
0
down vote
favorite
I have multiple apps with same source code. So I dive into the product Flavor. All apps have same flow. Only their name ,color sheme packageName and appIcon is different.
One base url is different all other data is same. I want to have single code for all the apps. So I created different folder for holding string and color.xml for each flavor under app->src directory. I want not to add other product flavor resources while signing build.
android
compileSdkVersion 25
buildToolsVersion '27.0.2'
flavorDimensions "tier"
defaultConfig
applicationId "com.example.broadpeak.gradlepracticing"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
signingConfigs
appleFlavor
keyAlias 'appleFlavor'
storeFile file('E:/keystoreForTest/appleFlavor.jks')
keyPassword 'password'
storePassword 'password'
mangoFlavor
keyAlias 'mangoFlavor'
storeFile file('E:/keystoreForTest/chocolateFlavor.jks')
keyPassword 'password'
storePassword 'password'
chocolateFlavor
keyAlias 'chocolateFlavor'
storeFile file('E:/keystoreForTest/chocolateFlavor.jks')
keyPassword 'password'
storePassword 'password'
sourceSets
/*main
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src/commonFiles/java']
resources.srcDirs = ['src/commonFiles/java']
aidl.srcDirs = ['src/commonFiles/java']
renderscript.srcDirs = ['src/commonFiles/java']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
flavor1
java.srcDirs = ['src-flavor1']
res.srcDirs = ['res-flavor1']
*/
appleFlavorDebug
res.srcDirs =
[
'/src/appleFlavor/res/values/colors',
'/src/appleFlavor/res/values/styles',
'/src/appleFlavor/res/values/string'
]
productFlavors
appleFlavor
applicationId "broadpeak.apple.flavor"
versionCode 1
versionName "1.0"
buildConfigField "int", "COLORING", "0xff0000"
buildConfigField "String", "FOO_STRING", ""foo11""
buildConfigField "boolean", "LOG", "false"
resValue "string", "new_name", "Apple"
manifestPlaceholders = [appName: "Apple"]
flavorDimensions "tier"
signingConfig signingConfigs.appleFlavor
/*manifestPlaceholders = [
appIcon: "@mipmap/ic_launcher_test" -- android:icon="$appIcon" in application TAg in manifest*/
mangoFlavor
applicationId "broadpeak.mango.flavor"
versionCode 1
versionName "1.0"
buildConfigField "int", "COLORING", "0xffff00"
buildConfigField "String", "FOO_STRING", ""foo12""
buildConfigField "boolean", "LOG", "false"
resValue "string", "new_name", "Mango"
manifestPlaceholders = [appName: "Mango"]
flavorDimensions "tier"
signingConfig signingConfigs.mangoFlavor
chocolateFlavor
applicationId "broadpeak.chocolate.flavor"
versionCode 1
versionName "1.0"
buildConfigField "int", "COLORING", "0x00ffff"
buildConfigField "String", "FOO_STRING", ""foo13""
buildConfigField "boolean", "LOG", "true"
resValue "string", "new_name", "Chocolate"
manifestPlaceholders = [appName: "Chocolate"]
flavorDimensions "tier"
signingConfig signingConfigs.chocolateFlavor
buildTypes
release
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
/*signingConfig signingConfigs.appleFlavor
signingConfig signingConfigs.mangoFlavor
signingConfig signingConfigs.chocolateFlavor*/
debug
minifyEnabled false
shrinkResources false
android gradle
add a comment |Â
up vote
0
down vote
favorite
I have multiple apps with same source code. So I dive into the product Flavor. All apps have same flow. Only their name ,color sheme packageName and appIcon is different.
One base url is different all other data is same. I want to have single code for all the apps. So I created different folder for holding string and color.xml for each flavor under app->src directory. I want not to add other product flavor resources while signing build.
android
compileSdkVersion 25
buildToolsVersion '27.0.2'
flavorDimensions "tier"
defaultConfig
applicationId "com.example.broadpeak.gradlepracticing"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
signingConfigs
appleFlavor
keyAlias 'appleFlavor'
storeFile file('E:/keystoreForTest/appleFlavor.jks')
keyPassword 'password'
storePassword 'password'
mangoFlavor
keyAlias 'mangoFlavor'
storeFile file('E:/keystoreForTest/chocolateFlavor.jks')
keyPassword 'password'
storePassword 'password'
chocolateFlavor
keyAlias 'chocolateFlavor'
storeFile file('E:/keystoreForTest/chocolateFlavor.jks')
keyPassword 'password'
storePassword 'password'
sourceSets
/*main
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src/commonFiles/java']
resources.srcDirs = ['src/commonFiles/java']
aidl.srcDirs = ['src/commonFiles/java']
renderscript.srcDirs = ['src/commonFiles/java']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
flavor1
java.srcDirs = ['src-flavor1']
res.srcDirs = ['res-flavor1']
*/
appleFlavorDebug
res.srcDirs =
[
'/src/appleFlavor/res/values/colors',
'/src/appleFlavor/res/values/styles',
'/src/appleFlavor/res/values/string'
]
productFlavors
appleFlavor
applicationId "broadpeak.apple.flavor"
versionCode 1
versionName "1.0"
buildConfigField "int", "COLORING", "0xff0000"
buildConfigField "String", "FOO_STRING", ""foo11""
buildConfigField "boolean", "LOG", "false"
resValue "string", "new_name", "Apple"
manifestPlaceholders = [appName: "Apple"]
flavorDimensions "tier"
signingConfig signingConfigs.appleFlavor
/*manifestPlaceholders = [
appIcon: "@mipmap/ic_launcher_test" -- android:icon="$appIcon" in application TAg in manifest*/
mangoFlavor
applicationId "broadpeak.mango.flavor"
versionCode 1
versionName "1.0"
buildConfigField "int", "COLORING", "0xffff00"
buildConfigField "String", "FOO_STRING", ""foo12""
buildConfigField "boolean", "LOG", "false"
resValue "string", "new_name", "Mango"
manifestPlaceholders = [appName: "Mango"]
flavorDimensions "tier"
signingConfig signingConfigs.mangoFlavor
chocolateFlavor
applicationId "broadpeak.chocolate.flavor"
versionCode 1
versionName "1.0"
buildConfigField "int", "COLORING", "0x00ffff"
buildConfigField "String", "FOO_STRING", ""foo13""
buildConfigField "boolean", "LOG", "true"
resValue "string", "new_name", "Chocolate"
manifestPlaceholders = [appName: "Chocolate"]
flavorDimensions "tier"
signingConfig signingConfigs.chocolateFlavor
buildTypes
release
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
/*signingConfig signingConfigs.appleFlavor
signingConfig signingConfigs.mangoFlavor
signingConfig signingConfigs.chocolateFlavor*/
debug
minifyEnabled false
shrinkResources false
android gradle
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have multiple apps with same source code. So I dive into the product Flavor. All apps have same flow. Only their name ,color sheme packageName and appIcon is different.
One base url is different all other data is same. I want to have single code for all the apps. So I created different folder for holding string and color.xml for each flavor under app->src directory. I want not to add other product flavor resources while signing build.
android
compileSdkVersion 25
buildToolsVersion '27.0.2'
flavorDimensions "tier"
defaultConfig
applicationId "com.example.broadpeak.gradlepracticing"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
signingConfigs
appleFlavor
keyAlias 'appleFlavor'
storeFile file('E:/keystoreForTest/appleFlavor.jks')
keyPassword 'password'
storePassword 'password'
mangoFlavor
keyAlias 'mangoFlavor'
storeFile file('E:/keystoreForTest/chocolateFlavor.jks')
keyPassword 'password'
storePassword 'password'
chocolateFlavor
keyAlias 'chocolateFlavor'
storeFile file('E:/keystoreForTest/chocolateFlavor.jks')
keyPassword 'password'
storePassword 'password'
sourceSets
/*main
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src/commonFiles/java']
resources.srcDirs = ['src/commonFiles/java']
aidl.srcDirs = ['src/commonFiles/java']
renderscript.srcDirs = ['src/commonFiles/java']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
flavor1
java.srcDirs = ['src-flavor1']
res.srcDirs = ['res-flavor1']
*/
appleFlavorDebug
res.srcDirs =
[
'/src/appleFlavor/res/values/colors',
'/src/appleFlavor/res/values/styles',
'/src/appleFlavor/res/values/string'
]
productFlavors
appleFlavor
applicationId "broadpeak.apple.flavor"
versionCode 1
versionName "1.0"
buildConfigField "int", "COLORING", "0xff0000"
buildConfigField "String", "FOO_STRING", ""foo11""
buildConfigField "boolean", "LOG", "false"
resValue "string", "new_name", "Apple"
manifestPlaceholders = [appName: "Apple"]
flavorDimensions "tier"
signingConfig signingConfigs.appleFlavor
/*manifestPlaceholders = [
appIcon: "@mipmap/ic_launcher_test" -- android:icon="$appIcon" in application TAg in manifest*/
mangoFlavor
applicationId "broadpeak.mango.flavor"
versionCode 1
versionName "1.0"
buildConfigField "int", "COLORING", "0xffff00"
buildConfigField "String", "FOO_STRING", ""foo12""
buildConfigField "boolean", "LOG", "false"
resValue "string", "new_name", "Mango"
manifestPlaceholders = [appName: "Mango"]
flavorDimensions "tier"
signingConfig signingConfigs.mangoFlavor
chocolateFlavor
applicationId "broadpeak.chocolate.flavor"
versionCode 1
versionName "1.0"
buildConfigField "int", "COLORING", "0x00ffff"
buildConfigField "String", "FOO_STRING", ""foo13""
buildConfigField "boolean", "LOG", "true"
resValue "string", "new_name", "Chocolate"
manifestPlaceholders = [appName: "Chocolate"]
flavorDimensions "tier"
signingConfig signingConfigs.chocolateFlavor
buildTypes
release
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
/*signingConfig signingConfigs.appleFlavor
signingConfig signingConfigs.mangoFlavor
signingConfig signingConfigs.chocolateFlavor*/
debug
minifyEnabled false
shrinkResources false
android gradle
I have multiple apps with same source code. So I dive into the product Flavor. All apps have same flow. Only their name ,color sheme packageName and appIcon is different.
One base url is different all other data is same. I want to have single code for all the apps. So I created different folder for holding string and color.xml for each flavor under app->src directory. I want not to add other product flavor resources while signing build.
android
compileSdkVersion 25
buildToolsVersion '27.0.2'
flavorDimensions "tier"
defaultConfig
applicationId "com.example.broadpeak.gradlepracticing"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
signingConfigs
appleFlavor
keyAlias 'appleFlavor'
storeFile file('E:/keystoreForTest/appleFlavor.jks')
keyPassword 'password'
storePassword 'password'
mangoFlavor
keyAlias 'mangoFlavor'
storeFile file('E:/keystoreForTest/chocolateFlavor.jks')
keyPassword 'password'
storePassword 'password'
chocolateFlavor
keyAlias 'chocolateFlavor'
storeFile file('E:/keystoreForTest/chocolateFlavor.jks')
keyPassword 'password'
storePassword 'password'
sourceSets
/*main
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src/commonFiles/java']
resources.srcDirs = ['src/commonFiles/java']
aidl.srcDirs = ['src/commonFiles/java']
renderscript.srcDirs = ['src/commonFiles/java']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
flavor1
java.srcDirs = ['src-flavor1']
res.srcDirs = ['res-flavor1']
*/
appleFlavorDebug
res.srcDirs =
[
'/src/appleFlavor/res/values/colors',
'/src/appleFlavor/res/values/styles',
'/src/appleFlavor/res/values/string'
]
productFlavors
appleFlavor
applicationId "broadpeak.apple.flavor"
versionCode 1
versionName "1.0"
buildConfigField "int", "COLORING", "0xff0000"
buildConfigField "String", "FOO_STRING", ""foo11""
buildConfigField "boolean", "LOG", "false"
resValue "string", "new_name", "Apple"
manifestPlaceholders = [appName: "Apple"]
flavorDimensions "tier"
signingConfig signingConfigs.appleFlavor
/*manifestPlaceholders = [
appIcon: "@mipmap/ic_launcher_test" -- android:icon="$appIcon" in application TAg in manifest*/
mangoFlavor
applicationId "broadpeak.mango.flavor"
versionCode 1
versionName "1.0"
buildConfigField "int", "COLORING", "0xffff00"
buildConfigField "String", "FOO_STRING", ""foo12""
buildConfigField "boolean", "LOG", "false"
resValue "string", "new_name", "Mango"
manifestPlaceholders = [appName: "Mango"]
flavorDimensions "tier"
signingConfig signingConfigs.mangoFlavor
chocolateFlavor
applicationId "broadpeak.chocolate.flavor"
versionCode 1
versionName "1.0"
buildConfigField "int", "COLORING", "0x00ffff"
buildConfigField "String", "FOO_STRING", ""foo13""
buildConfigField "boolean", "LOG", "true"
resValue "string", "new_name", "Chocolate"
manifestPlaceholders = [appName: "Chocolate"]
flavorDimensions "tier"
signingConfig signingConfigs.chocolateFlavor
buildTypes
release
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
/*signingConfig signingConfigs.appleFlavor
signingConfig signingConfigs.mangoFlavor
signingConfig signingConfigs.chocolateFlavor*/
debug
minifyEnabled false
shrinkResources false
android gradle
asked Feb 8 at 10:27
Xar E Ahmer
1314
1314
add a comment |Â
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f187083%2fgradle-for-product-flavor%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password