Flavoured source code is not complied in android
I have two flavours in my app with the following structure:
src
|
flavour_1
| |
| java
| |
| res
|
flavour_2
|
java
|
res
and here is my app gradle:
productFlavors{
flavour_1{
dimension "version"
applicationIdSuffix ".flavour_1"
versionNameSuffix "-flavour_1"
}
flavour_2{
dimension "version"
applicationIdSuffix ".flavour_2"
versionNameSuffix "-flavour_2"
}
}
sourceSets {
flavour_2{
java{
srcDirs = ["src/flavour_2/java", "src/main/java"]
}
}
}
Using different resources works perfectly fine but, when I have a new source code, then it gets messy. If I debug it, it starts with the code in main app and then goes to the flavoured one but surprisingly it does not do what it is on the flavoured one... it still follows the main source.
I have tried to clean and rebuild. Also removed the caches. I introduced sourceSets in my app gradle pointing to the folder where the flavours keep the code. But none works!
What am I missing in my structure or configuring my flavours?
add a comment |
I have two flavours in my app with the following structure:
src
|
flavour_1
| |
| java
| |
| res
|
flavour_2
|
java
|
res
and here is my app gradle:
productFlavors{
flavour_1{
dimension "version"
applicationIdSuffix ".flavour_1"
versionNameSuffix "-flavour_1"
}
flavour_2{
dimension "version"
applicationIdSuffix ".flavour_2"
versionNameSuffix "-flavour_2"
}
}
sourceSets {
flavour_2{
java{
srcDirs = ["src/flavour_2/java", "src/main/java"]
}
}
}
Using different resources works perfectly fine but, when I have a new source code, then it gets messy. If I debug it, it starts with the code in main app and then goes to the flavoured one but surprisingly it does not do what it is on the flavoured one... it still follows the main source.
I have tried to clean and rebuild. Also removed the caches. I introduced sourceSets in my app gradle pointing to the folder where the flavours keep the code. But none works!
What am I missing in my structure or configuring my flavours?
1
I don't know what you want to achieve here, but maybe the error is the extra space in the applicationIdSuffix?
– Ahmed Hegazy
2 days ago
Sorry, that was just a typo
– msc87
2 days ago
I don't know if it's the problem, but I don't think you need thatsourceSetsblock. It should look for sources there by default anyway. Can you describe the behavior in a little more detail? I'm not sure I'm following what is happening. Also if you see something when debugging that doesn't seem right it may be worth using some logging statements to double check what the debugger shows.
– nasch
2 days ago
add a comment |
I have two flavours in my app with the following structure:
src
|
flavour_1
| |
| java
| |
| res
|
flavour_2
|
java
|
res
and here is my app gradle:
productFlavors{
flavour_1{
dimension "version"
applicationIdSuffix ".flavour_1"
versionNameSuffix "-flavour_1"
}
flavour_2{
dimension "version"
applicationIdSuffix ".flavour_2"
versionNameSuffix "-flavour_2"
}
}
sourceSets {
flavour_2{
java{
srcDirs = ["src/flavour_2/java", "src/main/java"]
}
}
}
Using different resources works perfectly fine but, when I have a new source code, then it gets messy. If I debug it, it starts with the code in main app and then goes to the flavoured one but surprisingly it does not do what it is on the flavoured one... it still follows the main source.
I have tried to clean and rebuild. Also removed the caches. I introduced sourceSets in my app gradle pointing to the folder where the flavours keep the code. But none works!
What am I missing in my structure or configuring my flavours?
I have two flavours in my app with the following structure:
src
|
flavour_1
| |
| java
| |
| res
|
flavour_2
|
java
|
res
and here is my app gradle:
productFlavors{
flavour_1{
dimension "version"
applicationIdSuffix ".flavour_1"
versionNameSuffix "-flavour_1"
}
flavour_2{
dimension "version"
applicationIdSuffix ".flavour_2"
versionNameSuffix "-flavour_2"
}
}
sourceSets {
flavour_2{
java{
srcDirs = ["src/flavour_2/java", "src/main/java"]
}
}
}
Using different resources works perfectly fine but, when I have a new source code, then it gets messy. If I debug it, it starts with the code in main app and then goes to the flavoured one but surprisingly it does not do what it is on the flavoured one... it still follows the main source.
I have tried to clean and rebuild. Also removed the caches. I introduced sourceSets in my app gradle pointing to the folder where the flavours keep the code. But none works!
What am I missing in my structure or configuring my flavours?
edited 2 days ago
msc87
asked 2 days ago
msc87msc87
3832829
3832829
1
I don't know what you want to achieve here, but maybe the error is the extra space in the applicationIdSuffix?
– Ahmed Hegazy
2 days ago
Sorry, that was just a typo
– msc87
2 days ago
I don't know if it's the problem, but I don't think you need thatsourceSetsblock. It should look for sources there by default anyway. Can you describe the behavior in a little more detail? I'm not sure I'm following what is happening. Also if you see something when debugging that doesn't seem right it may be worth using some logging statements to double check what the debugger shows.
– nasch
2 days ago
add a comment |
1
I don't know what you want to achieve here, but maybe the error is the extra space in the applicationIdSuffix?
– Ahmed Hegazy
2 days ago
Sorry, that was just a typo
– msc87
2 days ago
I don't know if it's the problem, but I don't think you need thatsourceSetsblock. It should look for sources there by default anyway. Can you describe the behavior in a little more detail? I'm not sure I'm following what is happening. Also if you see something when debugging that doesn't seem right it may be worth using some logging statements to double check what the debugger shows.
– nasch
2 days ago
1
1
I don't know what you want to achieve here, but maybe the error is the extra space in the applicationIdSuffix?
– Ahmed Hegazy
2 days ago
I don't know what you want to achieve here, but maybe the error is the extra space in the applicationIdSuffix?
– Ahmed Hegazy
2 days ago
Sorry, that was just a typo
– msc87
2 days ago
Sorry, that was just a typo
– msc87
2 days ago
I don't know if it's the problem, but I don't think you need that
sourceSets block. It should look for sources there by default anyway. Can you describe the behavior in a little more detail? I'm not sure I'm following what is happening. Also if you see something when debugging that doesn't seem right it may be worth using some logging statements to double check what the debugger shows.– nasch
2 days ago
I don't know if it's the problem, but I don't think you need that
sourceSets block. It should look for sources there by default anyway. Can you describe the behavior in a little more detail? I'm not sure I'm following what is happening. Also if you see something when debugging that doesn't seem right it may be worth using some logging statements to double check what the debugger shows.– nasch
2 days ago
add a comment |
0
active
oldest
votes
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%2f54252446%2fflavoured-source-code-is-not-complied-in-android%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
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.
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%2f54252446%2fflavoured-source-code-is-not-complied-in-android%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
1
I don't know what you want to achieve here, but maybe the error is the extra space in the applicationIdSuffix?
– Ahmed Hegazy
2 days ago
Sorry, that was just a typo
– msc87
2 days ago
I don't know if it's the problem, but I don't think you need that
sourceSetsblock. It should look for sources there by default anyway. Can you describe the behavior in a little more detail? I'm not sure I'm following what is happening. Also if you see something when debugging that doesn't seem right it may be worth using some logging statements to double check what the debugger shows.– nasch
2 days ago