title: Build failed: "java.util.zip.ZipException: duplicate entry: com/google/android/gms/analytics/internal/Command.class"
body: <p>I'm trying to port an old android app to new devices. It works well from Android 5.x to 7.1, but it doesn't work in Android 4.x versions.</p>
  
  <p>When I try to install it in an android device or in a emulator with Android 4.x the build always fails with the same exception:</p>
  
  <pre><code>Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
  </code></pre>
  
  <blockquote>
    <p>com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/analytics/internal/Command.class</p>
  </blockquote>
  
  <p>I tried to search that "duplicate entry", but I was unable. I'm not sure what's the problem.</p>
  
  <p>This is my build-gradle file:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>apply plugin: 'com.android.application'
  
  android {
      compileSdkVersion 25
      buildToolsVersion "25.0.2"
      defaultConfig {
          applicationId "app-name"
          minSdkVersion 14
          targetSdkVersion 17
          multiDexEnabled true
      }
      configurations {
          all*.exclude group: 'com.android.support', module: 'support-v4'
          all*.exclude group: 'com.android.support', module: 'support-annotations'
      }
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
          }
      }
      productFlavors {
      }
  }
  
  dependencies {
      compile ('com.android.support:support-v4:25.0.0'){
          exclude module: 'support-v4'
      }
      compile ('com.google.android.gms:play-services:8.4.0'){
          exclude module: 'support-v4'
      }
      compile files('libs/libGoogleAnalyticsServices.jar')
  }</code></pre>
  </div>
  </div>
  </p>