title: Using Build Flavors - Structuring source folders and build.gradle correctly
body: <p><strong>Please note:</strong> Answer edited after Xavier's Answer</p>
  
  <p>I am trying to use different <a href="http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Product-flavors" rel="noreferrer">Build Flavors</a> for one same Application project in Android Studio. However, I seem to be having a terrible time configuring it to work appropriately. </p>
  
  <p><strong>Steps:</strong> </p>
  
  <ol>
  <li>Create a new Android Studio Project, named 'Test'. </li>
  <li><p>Open build.gradle* and added the following lines: </p>
  
  <pre><code>productFlavors {
  flavor1 {
      packageName 'com.android.studio.test.flavor1'
      }
  flavor2 {
      packageName 'com.android.studio.test.flavor2'
      }
  }
  </code></pre></li>
  <li>After restarting Android Studio, I now see <strong>4 build variants</strong> under the Build Variants section. Meaning we were succesful on seting up the product flavors so far. **</li>
  <li><p>Created a new Source folder for <strong>flavor1</strong>; however, I am not sure if I'm doing it the right way. Here's how I did it: </p>
  
  <ul>
  <li>Keep in mind that my Package name for this project is: <code>com.foo.test</code></li>
  <li>Right click on the <code>src</code> folder, for flavor1, I actually created the individual folders in the explorer, in a way that the structure is <code>src/flavor1/java/com/foo/test/MainActivity.java</code>. </li>
  <li>The above worked well, since the 'java' folder is in <strong>blue</strong>, meaning the IDE knows its an active source directory. Also, the package was automatically created. Despite of this, I am getting a warning for duplicate class found. <a href="http://db.tt/HTyvf4AP" rel="noreferrer">See screenshot here.</a> </li>
  <li>For flavor2, I tried creating the package manually, but 'src' folder for flavor2 seems not be in blue, and therefore the options are different when right clicked, and 'New Package' is not available for me to use. <a href="http://db.tt/nU5oXbS1" rel="noreferrer">See image here.</a> </li>
  <li>Note that for flavor1, I also created a 'res' directory, which does turn blue, but despite of that, doesn't offer the ability to create either an Android Resource file, or Andorid resource directory, in case I wanted to use different resoruces for different flavors. </li>
  </ul></li>
  </ol>
  
  <p>Am I doing something wrong? Or am I missing something? Let me know if you need more info. </p>
  
  <p>*My Project seems to have <strong>two</strong> build.gradle files. One located on the root of the project folder (\GradleTest), this one is empty. The second one located on the root of a subfolder of \GradleTest, also labeled 'GradleTest' (GradleTest-GradleTest), this is the one that already had code when opened; therefore, that is the one I edited. </p>
  
  <p>** I checked gradle settings and apparently <strong>Use auto-import</strong> was <a href="http://db.tt/hKd951HK" rel="noreferrer">already enabled.</a> Despite of this, making changes to the build.gradle file <a href="http://db.tt/qCWXEi2V" rel="noreferrer">doesn't automatically update</a> the build variants. <strong>Note:</strong> I also tried using Build - Rebuild Project, and/or Build - Make Project, no-go. I still have to close the project, and re-open for changes to take effect. </p>