title: Android gradle buildTypes: Duplicate class
body: <p>I'm converting my app to use gradle, and I'm trying to use the buildTypes. I have a <code>Constants</code> class which I wish to modify for my release build. So I have a file at <code>src/main/java/my/package/name/Constants.java</code> and at <code>src/release/java/my/package/name/Constants.java</code>.</p>
  
  <p>When I try to build this, gradle tells me the build failed on the <code>Constants</code> file in my release buildtype, with the error that it's a duplicate class.</p>
  
  <p>I also tried adding a different sourceSet for this in my <code>build.gradle</code> like this:</p>
  
  <pre><code>sourceSets {
      main {
          java.srcDirs = ['src/main/java'];
          //...
      }
      release {
          java.srcDirs = ['src/release/java'];
      }
  }
  </code></pre>
  
  <p>But this still gives me the same error. So I'm wondering, what am I doing wrong here?</p>