title: DexArchiveBuilderException: Failed to process /xxx/.gradle/caches/transforms-1/files-1.1/play-services-location-11.2.2.aar
body: <p>When I try to compile my project I get this weird error:</p>
  
  <pre><code>What went wrong:
  Execution failed for task ':android:transformClassesWithDexBuilderForProdDevelopmentDebug'.
  </code></pre>
  
  <blockquote>
    <p>com.android.build.api.transform.TransformException: com.android.builder.dexing.DexArchiveBuilderException: com.android.builder.dexing.DexArchiveBuilderException: Failed to process /Users/.../.gradle/caches/transforms-1/files-1.1/play-services-location-11.2.2.aar/f5b9886774f73d8b64cfd9701f91e8cc/jars/classes.jar</p>
  </blockquote>
  
  <p><strong>What I tried:</strong></p>
  
  <ol>
  <li>Added <code>multiDexEnabled true</code> to app gradle.</li>
  <li>Added <code>android.enableD8.desugaring = true</code> and <code>android.enableD8=true</code> to gradle.properties</li>
  <li>Also removed .gradle folder and did rebuild + clean</li>
  <li>Also did the following: SDK manager -> Google play services -> updated. Rebuild + clean afterwards.</li>
  </ol>
  
  <hr>
  
  <p>AS version: 3.1.4</p>
  
  <p>App gradle file:</p>
  
  <pre><code>apply plugin: 'com.android.application'
  apply plugin: 'kotlin-android'
  apply plugin: 'kotlin-android-extensions'
  apply plugin: 'kotlin-kapt'
  
  android {
      compileSdkVersion Android.compileSdkVersion
      buildToolsVersion Android.buildToolsVersion
      flavorDimensions "...", "type"
  
      defaultConfig {
          applicationId "xxx"
          versionName 'xxx'
          versionCode xxx
          minSdkVersion 21
          targetSdkVersion Android.targetSdkVersion //Android.targetSdkVersion holds value "27"
          multiDexEnabled true
      }
  
      dexOptions {
          javaMaxHeapSize "6g"
          preDexLibraries = true
      }
  
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
          }
      }
  
      productFlavors {           
          test {
              dimension "xxx"
              applicationIdSuffix '.xxx'
              versionNameSuffix 'x'
              manifestPlaceholders = [onesignal_app_id               : "",
                                      onesignal_google_project_number: ""]
          }
          production {
              dimension "xxx"
              manifestPlaceholders = [onesignal_app_id               : "",
                                      onesignal_google_project_number: ""]
          }
          development {
              dimension "type"
              resConfigs "xxhdpi"
          }
          normal {
              dimension "type"
          }
      }
  
      android.applicationVariants.all { variant -&gt;
          variant.outputs.all {
              outputFileName = "..."
          }
      }
  
      packagingOptions {
          exclude 'META-INF/LICENSE'
          exclude 'META-INF/NOTICE'
          exclude 'META-INF/LICENSE.txt'
          exclude 'META-INF/NOTICE.txt'
          exclude 'META-INF/services/javax.annotation.processing.Processor'
          exclude 'jsr305_annotations/Jsr305_annotations.gwt.xml'
          exclude 'build-data.properties'
          exclude 'error_prone/Annotations.gwt.xml'
          exclude 'third_party/java_src/error_prone/project/annotations/Annotations.gwt.xml'
          exclude 'third_party/java_src/error_prone/project/annotations/Google_internal.gwt.xml'
      }
  
      compileOptions {
          sourceCompatibility JavaVersion.VERSION_1_8
          targetCompatibility JavaVersion.VERSION_1_8
      }
  
      androidExtensions {
          experimental = true
      }
  }
  
  dependencies {
          implementation project(':projectxxx')
          implementation project(':tifCompanion')
          implementation fileTree(include: ['*.jar'], dir: 'libs')
          implementation files('libs/YouTubeAndroidPlayerApi.jar')
          kapt           "android.arch.lifecycle:compiler:1.1.1"
          implementation "android.arch.lifecycle:extensions:1.1.1"
          implementation "com.android.support.constraint:constraint-layout:1.1.0-beta5"
          kapt           "com.google.dagger:dagger-compiler:2.16"
          api            "com.android.support:leanback-v17:27.1.1"
          implementation "com.android.support:leanback-v17:27.1.1"
          api            "com.android.support:recommendation:27.1.1"
          implementation "com.android.support:recyclerview-v7:27.1.1"
          implementation "com.android.support:support-vector-drawable:27.1.1"
  }
  </code></pre>
  
  <p><em>projectxxx</em> which was implemented has these dependencies:</p>
  
  <pre><code>dependencies {
      api fileTree(include: ['*.jar'], dir: 'libs')
      api project(':JsonAPI') //https://github.com/faogustavo/JSONApi
      api            "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.2.61"
      implementation "com.onesignal:OneSignal:3.6.5"
      api            "com.google.android.gms:play-services-base:15.0.1"
      api            "com.google.android.gms:play-services-analytics:15.0.0"
      api            "com.android.support:support-annotations:27.1.1"
  }
  </code></pre>