title: Build flavors for different version of same class
body: <p>I've got a project, structured like this:</p>
  
  <pre><code>project/
     |
     |---src/
          |---flavorA2/
          |      |
          |      |---java/
          |      |     |---com.abc.flavorA.mk2
          |      |                 |-----classA.java
          |      |                 |-----classB.java
          |      |---res/
          |      |---AndroidManifest.xml
          |
          |---main
          |      |---java/
          |      |     |---com.abc.flavorA
          |      |                 |-----classA.java
          |      |                 |-----classB.java
          |      |                 |-----classC.java
          |      |                 |-----classD.java
          |      |---res/
          |      |    |---drawable/
          |      |    |---layout/
          |      |    |---values/
          |      |         
          |      |---AndroidManifest.xml
          |
          |---flavorA
  </code></pre>
  
  <p><code>flavorA</code> will use the source and assets from <code>main</code> completely while <code>flavorA2</code> has some small changes in <code>classA</code> and <code>classB</code> and the package name is also changed to <code>com.abc.flavorA.mk2</code>.</p>
  
  <p>I had the <code>build.gradle</code> file like this:</p>
  
  <pre><code>...
  buildTypes {
          release {
              runProguard false
              proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
          }
      }
      productFlavors {
          flavorA2 {
              packageName "com.abc.flavorA.mk2"
              versionCode 2
              versionName "1.0.1"
          }
  
          flavorA {
              packageName "com.abc.flavorA"
          }
      }
  ...
  </code></pre>
  
  <p>I run the code by selecting the build variant to <code>flavorA2</code>. However the running results shows that the gradle still choose the classes (<code>classA</code> and <code>classB</code>) from <code>main</code> instead of using the changed version inside <code>flavorA2</code>.</p>
  
  <p>Am I missing something here?</p>