title: java finished with non-zero exit value 2 when using Microft Azure SDK
body: <p>When I add to azure-android-sdk-2.0.2 in my gradle dependencies list,
  I get this error.</p>
  
  <pre><code>Error:Execution failed for task ':app:dexDebug'.
  &gt; com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home/bin/java'' finished with non-zero exit value 2
  </code></pre>
  
  <p>I have been researching almost 3 hours but I didn't find any solution.</p>
  
  <p>It is my gradle file.</p>
  
  <pre><code>dependencies {
      compile fileTree(dir: 'libs', include: ['*.jar'])
      compile 'com.android.support:appcompat-v7:22.1.1'
      compile 'com.google.android.gms:play-services:7.3.0'
      compile 'com.android.support:recyclerview-v7:22.0.0'
      compile 'com.melnykov:floatingactionbutton:1.1.0'
      compile 'com.android.support:support-v13:20.0.0'
      compile 'com.nispok:snackbar:2.10.6'
      compile 'ch.acra:acra:4.6.1'
      compile 'com.amazonaws:aws-android-sdk-core:2.1.3'
      compile 'com.amazonaws:aws-android-sdk-cognito:2.1.+'
      compile 'com.facebook.android:facebook-android-sdk:4.0.0'
      compile 'com.hannesdorfmann.smoothprogressbar:library:1.0.0'
      compile 'com.microsoft.azure:azure-mobile-services-android-sdk:2.0.2'
  }
  </code></pre>
  
  <p>main gradle file</p>
  
  <pre><code>dependencies {
          classpath 'com.android.tools.build:gradle:1.1.0'
  
          // NOTE: Do not place your application dependencies here; they belong
          // in the individual module build.gradle files
      }
  </code></pre>
  
  <p>My java version is v1.8.40</p>
  
  <p>Whwen ı remove <strong>com.google.android.gms:play-services:7.3.0</strong> applicaiton works. </p>
  
  <p>How can I solve this problem. ?</p>
  
  <p>I examined these links throughout.</p>
  
  <p><a href="https://stackoverflow.com/questions/29028705/java-exe-finished-with-non-zero-exit-value-2-when-using-facebook-sdk">java.exe finished with non-zero exit value 2 when using Facebook SDK</a></p>
  
  <p><a href="https://stackoverflow.com/questions/29296650/android-with-gradle-java-finished-with-non-zero-exit-value-2">Android with Gradle (Java finished with non-zero exit value 2)</a></p>
  
  <p><a href="https://stackoverflow.com/questions/29045129/android-java-exe-finished-with-non-zero-exit-value-1">Android java.exe finished with non-zero exit value 1</a></p>
  
  <p><strong>Update</strong></p>
  
  <p>I changed follow line in build.gradle to classpath </p>
  
  <blockquote>
    <p>'com.android.tools.build:gradle:1.0.0'</p>
  </blockquote>
  
  <p>from </p>
  
  <blockquote>
    <p>classpath 'com.android.tools.build:gradle:1.1.0'</p>
  </blockquote>
  
  <p>And App start to thrown that error.</p>
  
  <pre><code>Error:Execution failed for task ':app:dexDebug'.
  &gt; com.android.ide.common.internal.LoggedErrorException: Failed to run command:
      /Users/olkunmustafa/Documents/androidprojects/sdk/build-tools/19.1.0/dx --dex --no-optimize --output /Users/olkunmustafa/Documents/androidprojects/She/app/build/intermediates/dex/debug /Users/olkunmustafa/Documents/androidprojects/She/app/build/intermediates/classes/debug /Users/olkunmustafa/Documents/androidprojects/She/app/build/intermediates/pre-dexed/debug/support-annotations-22.0.0-5783c640b9ad3983da8141f842906022146a2d1a.jar /Users/olkunmustafa/Documents/androidprojects/She/app/build/intermediates/pre-dexed/debug/azure-notifications-handler-1.0.1-36bc1798984447ef547ee60b9063f0f91764d02e.jar /Users/olkunmustafa/Documents/androidprojects/She/app/build/intermediates/pre-dexed/debug/classes-e96ad7be8844daea91c282b97eea66352d373e90.jar /Users/olkunmustafa/Documents/androidprojects/She/app/build/intermediates/pre-dexed/debug/classes-e8c927fc2a8394b8a8047fe7578f9f9fa84c7d5e.jar /Users/olkunmustafa/Documents/androidprojects/She/app/build/intermediates/pre-dexed/debug/classes-f5c2dcb810e727ae4367a315df2729ee85079db6.jar /Users/olkunmustafa/Documents/androidprojects/She/app/build/intermediates/pre-dexed/debug/classes-120476480a34aefcd53992d8a24596d653db00fc.jar /Users/olkunmustafa/Documents/androidprojects/She/app/build/intermediates/pre-dexed/debug/classes-7e9e2dcdc72f05e978b5558cff0fa4c820eaa85f.jar /Users/olkunmustafa/Documents/androidprojects/She/app/build/intermediates/pre-dexed/debug/classes-b0d9c30f4770ce51356930fde57e56c8230a624c.jar /Users/olkunmustafa/Documents/androidprojects/She/app/build/intermediates/pre-dexed/debug/classes-a88a94dcf87d4fb4cf57120fc57a8b694360b210.jar /Users/olkunmustafa/Documents/androidprojects/She/app/build/intermediates/pre-dexed/debug/classes-8503e87c0ca9bfab1987f05a54f236f9ee935768.jar /Users/olkunmustafa/Documents/androidprojects/She/app/build/intermediates/pre-dexed/debug/classes-4ecb064cce96da3d62e1afe257b469d29dc7f9b9.jar /Users/olkunmustafa/Documents/androidprojects/She/app/build/intermediates/pre-dexed/debug/classes-db675e6b0e4fab972b35eb013bab6cd1d2f1cb82.jar /Users/olkunmustafa/Documents/androidprojects/She/app/build/intermediates/pre-dexed/debug/bolts-android-1.1.4-326d5d8fdc4c9f1dd8e71361727ef1c318617278.jar /Users/olkunmustafa/Documents/androidprojects/She/app/build/intermediates/pre-dexed/debug/classes-cfd3ccfaab62d72fdda73cce59ec1224c9e89ff1.jar /Users/olkunmustafa/Documents/androidprojects/She/app/build/intermediates/pre-dexed/debug/classes-e0f275f2fc5994aeaa5a3f0c6db416a392522f53.jar /Users/olkunmustafa/Documents/androidprojects/She/app/build/intermediates/pre-dexed/debug/library-2.4.0-3528813b3e0bd6a62c59e044952b26125d5f8c87.jar /Users/olkunmustafa/Documents/androidprojects/She/app/build/intermediates/pre-dexed/debug/classes-6008d16e6efc3d0e2cfe281f5027db552faa2584.jar /Users/olkunmustafa/Documents/androidprojects/She/app/build/intermediates/pre-dexed/debug/classes-30d7108829451fd2e500c87c6fed00eb1ed3e886.jar /Users/olkunmustafa/Documents/androidprojects/She/app/build/intermediates/pre-dexed/debug/acra-4.6.1-b8d37884ad519a7e403b2064501ca059d3f3c762.jar /Users/olkunmustafa/Documents/androidprojects/She/app/build/intermediates/pre-dexed/debug/classes-610b6030fe8a523d1f12619d40e66b2f3512cdf7.jar /Users/olkunmustafa/Documents/androidprojects/She/app/build/intermediates/pre-dexed/debug/classes-6c1f16122b8f751d0a0ea1d12be4ee25bade175f.jar /Users/olkunmustafa/Documents/androidprojects/She/app/build/intermediates/pre-dexed/debug/gson-2.3-94ac6e79783abcff8559622cd3f17ee5bea2cff8.jar /Users/olkunmustafa/Documents/androidprojects/She/app/build/intermediates/pre-dexed/debug/internal_impl-22.0.0-33f28feaa5277679687cfd680c84aee7bff1a648.jar /Users/olkunmustafa/Documents/androidprojects/She/app/build/intermediates/pre-dexed/debug/classes-e5aa9ad6d1b76d9332bd2f12c9a4084150b62f08.jar /Users/olkunmustafa/Documents/androidprojects/She/app/build/intermediates/pre-dexed/debug/classes-62df7db4779e6c1599a0c4ab24df46473179bcfe.jar /Users/olkunmustafa/Documents/androidprojects/She/app/build/intermediates/pre-dexed/debug/classes-0837506b99ce614f929d4f734c69669eea43dacc.jar /Users/olkunmustafa/Documents/androidprojects/She/app/build/intermediates/pre-dexed/debug/azure-mobile-services-android-sdk-2.0.2-6e6260662e949644b55748cc6162b748f14d7c7d.jar /Users/olkunmustafa/Documents/androidprojects/She/app/build/intermediates/pre-dexed/debug/classes-86cb529b366a2e39e1cf96a0ecc1d468e42ceef9.jar /Users/olkunmustafa/Documents/androidprojects/She/app/build/intermediates/pre-dexed/debug/classes-e8b9d9883dcb0890013225076f74bb60374f7c92.jar /Users/olkunmustafa/Documents/androidprojects/She/app/build/intermediates/pre-dexed/debug/classes-9fd595d7fe53a46d169a11c9bb7535cf595d9cb5.jar /Users/olkunmustafa/Documents/androidprojects/She/app/build/intermediates/pre-dexed/debug/classes-8e12b84113cffc394bbc8d33217879b756560a4c.jar /Users/olkunmustafa/Documents/androidprojects/She/app/build/intermediates/pre-dexed/debug/classes-454635f4c33c93ebb074b102a59c39ced1a7d7eb.jar /Users/olkunmustafa/Documents/androidprojects/She/app/build/intermediates/pre-dexed/debug/classes-26601e737cdbe198cd7d44b9aefc0310494194ac.jar /Users/olkunmustafa/Documents/androidprojects/She/app/build/intermediates/pre-dexed/debug/classes-1374fcbe87422f5c31f5e82afe6df8132f39f912.jar /Users/olkunmustafa/Documents/androidprojects/She/app/build/intermediates/pre-dexed/debug/guava-18.0-adf00b68e36773254127234090e42e3595b25cd9.jar
    Error Code:
      2
    Output:
      UNEXPECTED TOP-LEVEL EXCEPTION:
      java.lang.IllegalArgumentException: method ID not in [0, 0xffff]: 65536
          at com.android.dx.merge.DexMerger$6.updateIndex(DexMerger.java:501)
          at com.android.dx.merge.DexMerger$IdMerger.mergeSorted(DexMerger.java:276)
          at com.android.dx.merge.DexMerger.mergeMethodIds(DexMerger.java:490)
          at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:167)
          at com.android.dx.merge.DexMerger.merge(DexMerger.java:188)
          at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:439)
          at com.android.dx.command.dexer.Main.runMonoDex(Main.java:287)
          at com.android.dx.command.dexer.Main.run(Main.java:230)
          at com.android.dx.command.dexer.Main.main(Main.java:199)
          at com.android.dx.command.Main.main(Main.java:103)
  </code></pre>