title: UNEXPECTED TOP-LEVEL EXCEPTION in Android Studio
body: <p>In one of my projects i am getting this Exception while building gradle file </p>
  
  <blockquote>
    <p>Error:Execution failed for task ':emBazaarV4:dexDebug'.</p>
    
    <blockquote>
      <p>com.android.ide.common.internal.LoggedErrorException: Failed to run       command:  F:\AndroidSDK\build-tools\21.1.2\dx.bat --dex
      --no-optimize --output        F:\AndroidStudioWorkspace\EmBazaarV4\emBazaarV4\build\intermediates\dex\debug
      --input-  list=F:\AndroidStudioWorkspace\EmBazaarV4\emBazaarV4\build\intermediates\tmp\dex\debug\inputList.txt
      Error Code:   2 Output:   UNEXPECTED TOP-LEVEL EXCEPTION:
        com.android.dex.DexException: Multiple dex files define
      Lcom/google/gson/JsonSerializer;      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)</p>
    </blockquote>
  </blockquote>
  
  <p>and here is my dependencies</p>
  
  <pre><code>dependencies {
      compile 'com.facebook.android:facebook-android-sdk:3.22.0'
      compile 'com.aviary.android.feather.sdk:aviary-sdk:3.6.3'
      compile 'com.android.support:support-v4:21.0.3'
      compile 'com.google.android.gms:play-services:+'
      compile 'com.squareup.okhttp:okhttp:2.2.0'
      compile 'com.squareup.okio:okio:1.1.0'
      compile 'com.squareup.okhttp:okhttp-urlconnection:2.2.0'
      compile 'com.squareup.retrofit:retrofit:1.9.0'
      compile 'com.squareup.picasso:picasso:2.4.0'
      compile files('libs/commons-io-2.4.jar')
      compile files('libs/crashlytics.jar')
      compile files('libs/httpmime-4.1.3.jar')
      compile files('libs/jumblr-0.0.8-jar-with-dependencies.jar')
      compile files('libs/signpost-commonshttp4-1.2.1.2.jar')
      compile files('libs/signpost-core-1.2.1.2.jar')
      compile files('libs/simplesocialsharing.jar')
      compile files('libs/gcm.jar') }
  </code></pre>
  
  <p>I have tried everything but not getting how to exclude this multiple dex files. I have found solution for v4 like this</p>
  
  <pre><code> configurations {
      all*.exclude group: 'com.android.support', module: 'support-v4'
  }
  </code></pre>
  
  <p>so is there any general solution for these kind of errors?</p>