title: UNEXPECTED TOP-LEVEL EXCEPTION when testing using Gradle
body: <p>I'm pretty new to Gradle. My project is compiling file when I do a </p>
  
  <pre><code>./gradlew assembleDebug
  </code></pre>
  
  <p>But it doesn't when I try to run the tests:</p>
  
  <pre><code>./gradlew connectedCheck
  </code></pre>
  
  <p>I get (a couple of them):</p>
  
  <pre><code>UNEXPECTED TOP-LEVEL EXCEPTION:
  java.lang.IllegalArgumentException: already added: Lcom/facebook/AccessToken$SerializationProxyV1;
      at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:123)
      at com.android.dx.dex.file.DexFile.add(DexFile.java:163)
      at com.android.dx.command.dexer.Main.processClass(Main.java:490)
      at com.android.dx.command.dexer.Main.processFileBytes(Main.java:459)
      at com.android.dx.command.dexer.Main.access$400(Main.java:67)
      at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:398)
      at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:245)
      at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:131)
      at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:109)
      at com.android.dx.command.dexer.Main.processOne(Main.java:422)
      at com.android.dx.command.dexer.Main.processAllFiles(Main.java:333)
      at com.android.dx.command.dexer.Main.run(Main.java:209)
      at com.android.dx.command.dexer.Main.main(Main.java:174)
      at com.android.dx.command.Main.main(Main.java:91)
  </code></pre>
  
  <p>here is the structure of my project:</p>
  
  <pre><code>main app depends on:
      compile 'com.android.support:support-v4:18.0.+'
      compile 'com.android.support:gridlayout-v7:18.0.+'
      compile 'com.google.code.gson:gson:1.7.2'
      compile 'com.jakewharton:butterknife:2.0.1'
      compile 'com.squareup.retrofit:retrofit:1.1.1'
      compile 'com.squareup:otto:1.3.4'
      compile 'com.squareup.okhttp:okhttp:1.2.0'
      compile project(':Library:mylib')
  
  mylib depends on:
      compile 'com.android.support:support-v4:18.0.+'
      compile files('libs/facebooksdk.jar')
      compile files('libs/libGoogleAnalyticsV2.jar')
  </code></pre>
  
  <p>the exception is coming for each jars from mylib, after this line:</p>
  
  <pre><code>:Library:mylib:dexTest
  </code></pre>
  
  <p>any idea?</p>