How to manage two different applicationId in productFlavors?
I need to manage two different client code in single project so i have used productFlavors and defined flavor for each client.
Now the question is source code base is same for both but need to define different applicationId
like
- com.abc
- com.def.
How would I make flavor so that code remain same for both and appId
different?
android android-productflavors android-build-flavors
add a comment |
I need to manage two different client code in single project so i have used productFlavors and defined flavor for each client.
Now the question is source code base is same for both but need to define different applicationId
like
- com.abc
- com.def.
How would I make flavor so that code remain same for both and appId
different?
android android-productflavors android-build-flavors
Which code are you talking about? How does your code depend on application id?
– Khemraj
Nov 19 '18 at 12:12
You can just add suffix to applicationId like thisapplicationIdSuffix ".test"
.
– Khemraj
Nov 19 '18 at 12:12
You can as well do this manually by right clicking on app module and create new java folder, then, in the folder, create a new package
– Show Young Soyinka
Nov 19 '18 at 12:15
@Khemraj Simple question let say two customer. 1.Apple (com.au.apple) 2. Google (com.uk.google) Project code will remain same just logo will change for both. In this case how would I define above applicationId so that both can use common code.
– Rohan Patel
Nov 19 '18 at 12:18
add a comment |
I need to manage two different client code in single project so i have used productFlavors and defined flavor for each client.
Now the question is source code base is same for both but need to define different applicationId
like
- com.abc
- com.def.
How would I make flavor so that code remain same for both and appId
different?
android android-productflavors android-build-flavors
I need to manage two different client code in single project so i have used productFlavors and defined flavor for each client.
Now the question is source code base is same for both but need to define different applicationId
like
- com.abc
- com.def.
How would I make flavor so that code remain same for both and appId
different?
android android-productflavors android-build-flavors
android android-productflavors android-build-flavors
edited Nov 19 '18 at 14:50
Ali
1,73721030
1,73721030
asked Nov 19 '18 at 12:10
Rohan Patel
5911519
5911519
Which code are you talking about? How does your code depend on application id?
– Khemraj
Nov 19 '18 at 12:12
You can just add suffix to applicationId like thisapplicationIdSuffix ".test"
.
– Khemraj
Nov 19 '18 at 12:12
You can as well do this manually by right clicking on app module and create new java folder, then, in the folder, create a new package
– Show Young Soyinka
Nov 19 '18 at 12:15
@Khemraj Simple question let say two customer. 1.Apple (com.au.apple) 2. Google (com.uk.google) Project code will remain same just logo will change for both. In this case how would I define above applicationId so that both can use common code.
– Rohan Patel
Nov 19 '18 at 12:18
add a comment |
Which code are you talking about? How does your code depend on application id?
– Khemraj
Nov 19 '18 at 12:12
You can just add suffix to applicationId like thisapplicationIdSuffix ".test"
.
– Khemraj
Nov 19 '18 at 12:12
You can as well do this manually by right clicking on app module and create new java folder, then, in the folder, create a new package
– Show Young Soyinka
Nov 19 '18 at 12:15
@Khemraj Simple question let say two customer. 1.Apple (com.au.apple) 2. Google (com.uk.google) Project code will remain same just logo will change for both. In this case how would I define above applicationId so that both can use common code.
– Rohan Patel
Nov 19 '18 at 12:18
Which code are you talking about? How does your code depend on application id?
– Khemraj
Nov 19 '18 at 12:12
Which code are you talking about? How does your code depend on application id?
– Khemraj
Nov 19 '18 at 12:12
You can just add suffix to applicationId like this
applicationIdSuffix ".test"
.– Khemraj
Nov 19 '18 at 12:12
You can just add suffix to applicationId like this
applicationIdSuffix ".test"
.– Khemraj
Nov 19 '18 at 12:12
You can as well do this manually by right clicking on app module and create new java folder, then, in the folder, create a new package
– Show Young Soyinka
Nov 19 '18 at 12:15
You can as well do this manually by right clicking on app module and create new java folder, then, in the folder, create a new package
– Show Young Soyinka
Nov 19 '18 at 12:15
@Khemraj Simple question let say two customer. 1.Apple (com.au.apple) 2. Google (com.uk.google) Project code will remain same just logo will change for both. In this case how would I define above applicationId so that both can use common code.
– Rohan Patel
Nov 19 '18 at 12:18
@Khemraj Simple question let say two customer. 1.Apple (com.au.apple) 2. Google (com.uk.google) Project code will remain same just logo will change for both. In this case how would I define above applicationId so that both can use common code.
– Rohan Patel
Nov 19 '18 at 12:18
add a comment |
2 Answers
2
active
oldest
votes
add the code block set applicationId
like below :
productFlavors {
abc {
resValue "string", "build_type", "Version " + defaultConfig.versionName
applicationId "com.abc"
}
def {
resValue "string", "build_type", "Version " + defaultConfig.versionName
applicationId "com.def"
}
What will be the package name? I want both flavor use common code. I dont want to make separate packages for both.
– Rohan Patel
Nov 19 '18 at 12:19
just defineapplicationId "packageName"
it will remains your code same for both flavour just select flavour while making APK to set package name
– Rutvik Bhatt
Nov 19 '18 at 12:27
add a comment |
android will create main/
source set and directories for everything you want to share between all your build variants, so no need for creating new source set in your case.
And you could use applicationIdSuffix
for different build variants, which is appended to the "base" application id when calculating the final application id for a variant.For example :
flavorDimensions "appMode"
productFlavors {
free {
dimension "appMode"
applicationIdSuffix ".free" //the application id of 'free' is com.example.com.free
}
paid {
dimension "appMode"
applicationIdSuffix ".paid"//the application id of 'free' is com.example.com.paid
}
}
The applicationIdSuffix will be appended to the package name(base application id),
com.example.com
is the package name in above example.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
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
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53374360%2fhow-to-manage-two-different-applicationid-in-productflavors%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
add the code block set applicationId
like below :
productFlavors {
abc {
resValue "string", "build_type", "Version " + defaultConfig.versionName
applicationId "com.abc"
}
def {
resValue "string", "build_type", "Version " + defaultConfig.versionName
applicationId "com.def"
}
What will be the package name? I want both flavor use common code. I dont want to make separate packages for both.
– Rohan Patel
Nov 19 '18 at 12:19
just defineapplicationId "packageName"
it will remains your code same for both flavour just select flavour while making APK to set package name
– Rutvik Bhatt
Nov 19 '18 at 12:27
add a comment |
add the code block set applicationId
like below :
productFlavors {
abc {
resValue "string", "build_type", "Version " + defaultConfig.versionName
applicationId "com.abc"
}
def {
resValue "string", "build_type", "Version " + defaultConfig.versionName
applicationId "com.def"
}
What will be the package name? I want both flavor use common code. I dont want to make separate packages for both.
– Rohan Patel
Nov 19 '18 at 12:19
just defineapplicationId "packageName"
it will remains your code same for both flavour just select flavour while making APK to set package name
– Rutvik Bhatt
Nov 19 '18 at 12:27
add a comment |
add the code block set applicationId
like below :
productFlavors {
abc {
resValue "string", "build_type", "Version " + defaultConfig.versionName
applicationId "com.abc"
}
def {
resValue "string", "build_type", "Version " + defaultConfig.versionName
applicationId "com.def"
}
add the code block set applicationId
like below :
productFlavors {
abc {
resValue "string", "build_type", "Version " + defaultConfig.versionName
applicationId "com.abc"
}
def {
resValue "string", "build_type", "Version " + defaultConfig.versionName
applicationId "com.def"
}
answered Nov 19 '18 at 12:13
Rutvik Bhatt
1,052414
1,052414
What will be the package name? I want both flavor use common code. I dont want to make separate packages for both.
– Rohan Patel
Nov 19 '18 at 12:19
just defineapplicationId "packageName"
it will remains your code same for both flavour just select flavour while making APK to set package name
– Rutvik Bhatt
Nov 19 '18 at 12:27
add a comment |
What will be the package name? I want both flavor use common code. I dont want to make separate packages for both.
– Rohan Patel
Nov 19 '18 at 12:19
just defineapplicationId "packageName"
it will remains your code same for both flavour just select flavour while making APK to set package name
– Rutvik Bhatt
Nov 19 '18 at 12:27
What will be the package name? I want both flavor use common code. I dont want to make separate packages for both.
– Rohan Patel
Nov 19 '18 at 12:19
What will be the package name? I want both flavor use common code. I dont want to make separate packages for both.
– Rohan Patel
Nov 19 '18 at 12:19
just define
applicationId "packageName"
it will remains your code same for both flavour just select flavour while making APK to set package name– Rutvik Bhatt
Nov 19 '18 at 12:27
just define
applicationId "packageName"
it will remains your code same for both flavour just select flavour while making APK to set package name– Rutvik Bhatt
Nov 19 '18 at 12:27
add a comment |
android will create main/
source set and directories for everything you want to share between all your build variants, so no need for creating new source set in your case.
And you could use applicationIdSuffix
for different build variants, which is appended to the "base" application id when calculating the final application id for a variant.For example :
flavorDimensions "appMode"
productFlavors {
free {
dimension "appMode"
applicationIdSuffix ".free" //the application id of 'free' is com.example.com.free
}
paid {
dimension "appMode"
applicationIdSuffix ".paid"//the application id of 'free' is com.example.com.paid
}
}
The applicationIdSuffix will be appended to the package name(base application id),
com.example.com
is the package name in above example.
add a comment |
android will create main/
source set and directories for everything you want to share between all your build variants, so no need for creating new source set in your case.
And you could use applicationIdSuffix
for different build variants, which is appended to the "base" application id when calculating the final application id for a variant.For example :
flavorDimensions "appMode"
productFlavors {
free {
dimension "appMode"
applicationIdSuffix ".free" //the application id of 'free' is com.example.com.free
}
paid {
dimension "appMode"
applicationIdSuffix ".paid"//the application id of 'free' is com.example.com.paid
}
}
The applicationIdSuffix will be appended to the package name(base application id),
com.example.com
is the package name in above example.
add a comment |
android will create main/
source set and directories for everything you want to share between all your build variants, so no need for creating new source set in your case.
And you could use applicationIdSuffix
for different build variants, which is appended to the "base" application id when calculating the final application id for a variant.For example :
flavorDimensions "appMode"
productFlavors {
free {
dimension "appMode"
applicationIdSuffix ".free" //the application id of 'free' is com.example.com.free
}
paid {
dimension "appMode"
applicationIdSuffix ".paid"//the application id of 'free' is com.example.com.paid
}
}
The applicationIdSuffix will be appended to the package name(base application id),
com.example.com
is the package name in above example.
android will create main/
source set and directories for everything you want to share between all your build variants, so no need for creating new source set in your case.
And you could use applicationIdSuffix
for different build variants, which is appended to the "base" application id when calculating the final application id for a variant.For example :
flavorDimensions "appMode"
productFlavors {
free {
dimension "appMode"
applicationIdSuffix ".free" //the application id of 'free' is com.example.com.free
}
paid {
dimension "appMode"
applicationIdSuffix ".paid"//the application id of 'free' is com.example.com.paid
}
}
The applicationIdSuffix will be appended to the package name(base application id),
com.example.com
is the package name in above example.
answered Nov 19 '18 at 12:20
navylover
3,38521118
3,38521118
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
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
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53374360%2fhow-to-manage-two-different-applicationid-in-productflavors%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
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
Required, but never shown
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
Required, but never shown
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
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Which code are you talking about? How does your code depend on application id?
– Khemraj
Nov 19 '18 at 12:12
You can just add suffix to applicationId like this
applicationIdSuffix ".test"
.– Khemraj
Nov 19 '18 at 12:12
You can as well do this manually by right clicking on app module and create new java folder, then, in the folder, create a new package
– Show Young Soyinka
Nov 19 '18 at 12:15
@Khemraj Simple question let say two customer. 1.Apple (com.au.apple) 2. Google (com.uk.google) Project code will remain same just logo will change for both. In this case how would I define above applicationId so that both can use common code.
– Rohan Patel
Nov 19 '18 at 12:18