# Different resurse for builds

**URL:** <https://discuss.gradle.org/t/different-resurse-for-builds/7227>\
**Category:** Old Forum Archive\
**Created:** [October 14, 2013, 12:33pm UTC](https://discuss.gradle.org/t/different-resurse-for-builds/7227 "2013-10-14T12:33:00Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gron\_Bubsky](https://avatars.discourse-cdn.com/v4/letter/g/d2c977/32.png) [@Gron\_Bubsky](https://discuss.gradle.org/u/Gron_Bubsky)\
**Post date:** [October 14, 2013, 12:33pm UTC](https://discuss.gradle.org/t/different-resurse-for-builds/7227/1 "2013-10-14T12:33:00Z")

</div>

How can I configure gradle.build to build two different android apk. First one to debug or test with first type of resurse folder (for example, with strings.xml) and second one with other strings.xml for release (for example, with real urls)?

---

<div class="post-metadata">

**Author:** ![luke\_daley](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/luke_daley/32/9890_2.png) [@luke\_daley](https://discuss.gradle.org/u/luke_daley)\
**Post date:** [October 14, 2013, 12:46pm UTC](https://discuss.gradle.org/t/different-resurse-for-builds/7227/2 "2013-10-14T12:46:00Z")

</div>

This is solved by build flavors.

This is one of many blog posts on the Internet about this: [http://tulipemoutarde.be/2013/10/06/gradle-build-variants-for-your-android-project.html](http://tulipemoutarde.be/2013/10/06/gradle-build-variants-for-your-android-project.html)

---

<div class="post-metadata">

**Author:** ![Gron\_Bubsky](https://avatars.discourse-cdn.com/v4/letter/g/d2c977/32.png) [@Gron\_Bubsky](https://discuss.gradle.org/u/Gron_Bubsky)\
**Post date:** [October 14, 2013, 12:57pm UTC](https://discuss.gradle.org/t/different-resurse-for-builds/7227/3 "2013-10-14T12:57:00Z")

</div>

thanks, that is what i need, i red about it, but i dont understand how it use in past, but how can I build

definite flavors only?

---

<div class="post-metadata">

**Author:** ![luke\_daley](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/luke_daley/32/9890_2.png) [@luke\_daley](https://discuss.gradle.org/u/luke_daley)\
**Post date:** [October 14, 2013, 1:14pm UTC](https://discuss.gradle.org/t/different-resurse-for-builds/7227/4 "2013-10-14T13:14:00Z")

</div>

Set up some flavors, then run ‘gradle tasks’ you’ll see ‘assemble’ tasks (and others) for each flavor.

---

<div class="post-metadata">

**Author:** ![Gron\_Bubsky](https://avatars.discourse-cdn.com/v4/letter/g/d2c977/32.png) [@Gron\_Bubsky](https://discuss.gradle.org/u/Gron_Bubsky)\
**Post date:** [October 14, 2013, 1:22pm UTC](https://discuss.gradle.org/t/different-resurse-for-builds/7227/5 "2013-10-14T13:22:00Z")

</div>

thanx

---

<div class="post-metadata">

**Author:** ![Gron\_Bubsky](https://avatars.discourse-cdn.com/v4/letter/g/d2c977/32.png) [@Gron\_Bubsky](https://discuss.gradle.org/u/Gron_Bubsky)\
**Post date:** [October 14, 2013, 1:31pm UTC](https://discuss.gradle.org/t/different-resurse-for-builds/7227/6 "2013-10-14T13:31:00Z")

</div>

oh, one more tiny question, I have two builds, but when I tried to change AndroidManifest.xml for staging version I got an error that gradle can’t merge this file, does it mean that I can’t change AndroidManifest.xml?

---

<div class="post-metadata">

**Author:** ![luke\_daley](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/luke_daley/32/9890_2.png) [@luke\_daley](https://discuss.gradle.org/u/luke_daley)\
**Post date:** [October 14, 2013, 2:07pm UTC](https://discuss.gradle.org/t/different-resurse-for-builds/7227/7 "2013-10-14T14:07:00Z")

</div>

Some things can be merged and some can’t. I suggest running the build with the ‘-s’ flag to get more information about what is going wrong.

---

<div class="post-metadata">

**Author:** ![Gron\_Bubsky](https://avatars.discourse-cdn.com/v4/letter/g/d2c977/32.png) [@Gron\_Bubsky](https://discuss.gradle.org/u/Gron_Bubsky)\
**Post date:** [October 14, 2013, 2:11pm UTC](https://discuss.gradle.org/t/different-resurse-for-builds/7227/8 "2013-10-14T14:11:00Z")

</div>

i have 2 project type: src/main and src/staging; and i have different code in MainActivity.java, when I am trying to build it I got

```gradle
:generateStagingDebugSources UP-TO-DATE
:compileStagingDebug
/android_projects/GradleApplication/src/staging/java/com/gradleapplication/sample/MainActivity.java:9: error: duplicate class: com.gradleapplication.sample.MainActivity
public class MainActivity extends Activity {
       ^
/android_projects/GradleApplication/src/staging/java/com/gradleapplication/sample/SecondActivity.java:7: error: duplicate class: com.gradleapplication.sample.SecondActivity
public class SecondActivity extends Activity {
       ^
2 errors
:compileStagingDebug FAILED
  FAILURE: Build failed with an exception.
  * What went wrong:
Execution failed for task ':compileStagingDebug'.
> Compilation failed; see the compiler error output for details.
  * Try:
Run with --info or --debug option to get more log output.
  * Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':compileStagingDebug'.
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
        at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
        at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
        at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
        at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:42)
        at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
        at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)

```

---

<div class="post-metadata">

**Author:** ![luke\_daley](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/luke_daley/32/9890_2.png) [@luke\_daley](https://discuss.gradle.org/u/luke_daley)\
**Post date:** [October 14, 2013, 2:25pm UTC](https://discuss.gradle.org/t/different-resurse-for-builds/7227/9 "2013-10-14T14:25:00Z")

</div>

The plugin cannot merge classes. I suspect you have the same class duplicated in different flavor and build type source directories.
