title: D8: Cannot fit requested classes in the main-dex file. fields: 66685 > 65536 with "multiDexEnabled true"
body: <p>I am hitting the 65536 limit even though I believe that I do have multidex enabled. I have the following in my build.gradle:</p>
  
  <pre><code>android {
      compileSdkVersion 27
      buildToolsVersion '27.0.3'
  
      defaultConfig {
          minSdkVersion 16
          targetSdkVersion 27
  
          multiDexEnabled true
      }
  
  
      dexOptions {
          preDexLibraries false
          jumboMode true
          keepRuntimeAnnotatedClasses false
          // incremental false
          javaMaxHeapSize "2g" // Use gig increments depending on needs
      }
  }</code></pre>
  
  <p>I have my own Application implementation and I have tried extending MultiDexApplication and I have tried calling MultiDex.install(this); in attachBaseContext (not at the same time), but still I keep getting the following error:</p>
  
  <pre><code>D8: Cannot fit requested classes in the main-dex file.
  fields: 66685 > 65536
  java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives</code></pre>
  
  <p>Does this not mean that multidexing is not applied, so somehow multidex is not enabled in my build setup even though I do all I can to enable it, or what can cause this? Any ideas?</p>
  
  <p>Thank you<br>
  Søren</p>