title: Issue with Multiple Dex: in Build Config Files
body: <p>In the project, there are 3 modules, A,B,C. 
  A is having dependency of B and B is having dependency of C.</p>
  
  <p>Error Output: </p>
  
  <pre><code>Error:Execution failed for task ':app:dexDebug'.
  &gt; com.android.ide.common.internal.LoggedErrorException: Failed to run command:
      C:\Users\user\AppData\Local\Android\sdk\build-tools\21.1.2\dx.bat --dex --no-optimize --output C:\Testing\MyApplication\app\build\intermediates\dex\debug --input-list=C:\Testing\MyApplication\a\build\intermediates\tmp\dex\debug\inputList.txt
  Error Code:
      2
  Output:
      UNEXPECTED TOP-LEVEL EXCEPTION:
      com.android.dex.DexException: Multiple dex files define Lcom/test/test2/BuildConfig;
          at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
          at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
          at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
          at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
          at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
          at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
          at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)
          at com.android.dx.command.dexer.Main.run(Main.java:246)
          at com.android.dx.command.dexer.Main.main(Main.java:215)
          at com.android.dx.command.Main.main(Main.java:106)
  </code></pre>
  
  <p><strong>MainProject[settings.gradle]:</strong></p>
  
  <pre><code>include ':A', ':B', ':C'
  </code></pre>
  
  <p><strong>MainProject[build.gradle] :</strong></p>
  
  <pre><code>// Top-level build file where you can add configuration options common to all sub-projects/modules.
  
  buildscript {
      repositories {
          jcenter()
      }
      dependencies {
          classpath 'com.android.tools.build:gradle:1.0.0'
  
          // NOTE: Do not place your application dependencies here; they belong
          // in the individual module build.gradle files
      }
  }
  
  allprojects {
      repositories {
          jcenter()
      }
  }
  </code></pre>
  
  <p><strong>A.gradle :</strong></p>
  
  <pre><code>apply plugin: 'com.android.application'
  
  dependencies {
  
      compile 'com.google.android.gms:play-services:6.5.87'
      compile 'com.android.support:support-v4:21.0.3'
      compile 'com.android.support:appcompat-v7:21.0.3'
      compile project(':B')
  }
  
  android {
      compileSdkVersion 21
      buildToolsVersion "21.1.2"
  
      /*defaultConfig {
          minSdkVersion 9
          targetSdkVersion 21
      }*/
  
      lintOptions {
          abortOnError false
      }
  }
  </code></pre>
  
  <p><strong>B.gradle</strong> :</p>
  
  <pre><code>apply plugin: 'com.android.library'
  
  android {
      compileSdkVersion 21
      buildToolsVersion "21.1.2"
  
      defaultConfig {
          minSdkVersion 15
          targetSdkVersion 21
          versionCode 1
          versionName "1.0"
      }
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
          }
      }
  }
  
  dependencies {
      compile('de.keyboardsurfer.android.widget:crouton:1.8.5') {
          exclude group: 'com.android.support', module: 'support-v4'
      }
      compile fileTree(include: ['*.jar'], dir: 'libs')
      compile 'de.greenrobot:eventbus:2.2.1'
      compile 'com.mobsandgeeks:android-saripaar:1.0.3'
      compile 'com.loopj.android:android-async-http:1.4.6'
      compile project(':C')
      compile 'com.android.support:appcompat-v7:21.0.3'
  }
  </code></pre>
  
  <p><strong>C.gradle</strong> :</p>
  
  <pre><code>apply plugin: 'com.android.library'
  
  android {
      compileSdkVersion 21
      buildToolsVersion "21.1.2"
  
      defaultConfig {
          minSdkVersion 15
          targetSdkVersion 21
      }
  
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
          }
      }
  }
  
  dependencies {
      compile files('libs/classes.jar')
  }
  </code></pre>
  
  <p>If I am removing the duplication of appcpmpat-v7 in A and module B then I am getting the errors.</p>
  
  <p>Module C contains the compiled .class files.</p>
  
  <p>I am unable to understand the duplication of build.config files. What can be the solution of this problem?</p>