title: Cannot fit requested classes in the main-dex file (# methods: 73539 > 65536)
body: <p>Please I have an strange error when trying to build release.
  My project is multidex enabled and still gets that error. It seems to be related to the main-dex file, but I can't understand what the problem is.</p>
  
  <p>Also, I have the latest android studio 3.6.2 and latest Gradle build tools. On another note, I have a similar project like this and it builds release successfully.
  The main difference between both projects is that this project contains one extra feature:</p>
  
  <pre><code>classpath 'com.android.tools.build:gradle:3.6.2'
  </code></pre>
  
  <blockquote>
    <p>Cannot fit requested classes in the main-dex file (# methods: 73539 > 65536)</p>
  </blockquote>
  
  <p>my build.gradle file</p>
  
  <pre><code>apply plugin: 'com.android.application'
  apply plugin: 'io.fabric'
  apply plugin: 'jsonschema2pojo'
  apply plugin: 'com.google.firebase.firebase-perf'
  apply plugin: 'kotlin-android'
  apply plugin: 'kotlin-kapt'
  
  
  android {
  
  
      dataBinding {
          enabled = true
      }
  
      signingConfigs {
          compileSdkVersion 29
          defaultConfig {
              applicationId "com.madarsoft.fitness"
              minSdkVersion 17
              targetSdkVersion 29
              versionCode 113
              versionName "5.0.5"
              multiDexEnabled true
              testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
          }
          buildTypes {
              release {
                  debuggable false
                  minifyEnabled true
                  shrinkResources true
                  proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
              }
              debug {
                  debuggable true
                  minifyEnabled false
                  shrinkResources false
                  proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
              }
          }
  
  
          dexOptions {
              incremental true
              javaMaxHeapSize "4g"
              preDexLibraries = false
          }
  
  
          bundle {
              language {
                  enableSplit = true
              }
              density {
                  enableSplit = true
              }
              abi {
                  enableSplit = true
              }
          }
  
          /*sourceSets {
  
              main {
                  java.srcDirs = ['src/main/java', 'src/main/java/com.madarsoft.fitness/view']
  
              }
          }*/
      }
  
      repositories {
  
          maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
  
          maven { url 'https://bitbucket.org/tbdsrl/instal-publisher-sdk-releases/raw/master/' }
          maven { url "https://adcolony.bintray.com/AdColony" }
          maven { url "http://dl.appnext.com/" }
          mavenCentral()
          maven { url 'https://maven.fabric.io/public' }
          jcenter()
          flatDir {
              dirs 'libs'
          }
          jcenter()
          maven { url "http://dl.appnext.com/" }
          maven { url "https://s3.amazonaws.com/moat-sdk-builds" }
          maven {
              url 'https://maven.google.com/'
              name 'Google'
              google()
          } // necessary for Android API 26
          maven { url 'https://bitbucket.org/tbdsrl/instal-publisher-sdk-releases/raw/master/' }
          maven { url 'https://jitpack.io' }
      }
  
      dependencies {
  
  
          implementation 'androidx.multidex:multidex:2.0.1'
          implementation 'com.github.ibrahimsn98:NiceBottomBar:2.2'
          implementation(name: 'netperf-lib-238-release', ext: 'aar')
  
          implementation 'jp.wasabeef:recyclerview-animators:3.0.0'
          implementation 'com.mikhaellopez:circularprogressbar:3.0.3'
  
  
          implementation 'me.toptas.fancyshowcase:fancyshowcaseview:1.3.0'
  
  
          implementation "ru.tinkoff.scrollingpagerindicator:scrollingpagerindicator:1.0.0"
  
  
          implementation fileTree(include: ['*.jar'], dir: 'libs')
  
          implementation 'com.google.android.play:core:1.7.2'
  
          implementation 'com.github.jinatonic.confetti:confetti:1.1.2'
  
          implementation 'com.duolingo.open:rtl-viewpager:2.0.0'
  
          implementation 'com.github.esafirm.android-image-picker:imagepicker:2.2.0'
  
          implementation 'net.yslibrary.keyboardvisibilityevent:keyboardvisibilityevent:3.0.0-RC1'
  
          implementation 'com.scwang.wave:MultiWaveHeader:1.0.0-alpha-1'
  
          implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
  
  
          def room_version = "1.1.1"
  
          implementation "android.arch.persistence.room:runtime:$room_version"
          kapt "android.arch.persistence.room:compiler:$room_version"
  
  
          implementation 'com.google.firebase:firebase-perf:19.0.5'
  
          implementation 'com.google.android.gms:play-services-ads:19.0.1'
          implementation 'com.github.varunest:sparkbutton:1.0.6'
          implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.19'
          implementation 'com.romandanylyk:pageindicatorview:1.0.3'
          implementation 'com.booking:rtlviewpager:1.0.1'
          implementation 'com.google.code.gson:gson:2.8.5'
          implementation 'com.google.android.gms:play-services-maps:17.0.0'
          implementation 'com.daimajia.easing:library:2.0@aar'
          implementation 'com.daimajia.androidanimations:library:2.3@aar'
          implementation 'com.github.ozodrukh:CircularReveal:1.1.0'
          implementation 'com.skyfishjy.ripplebackground:library:1.0.1'
          implementation 'de.hdodenhof:circleimageview:3.1.0'
  
          //implementation 'com.github.javiersantos:AppUpdater:2.7'
  
  
          implementation 'com.github.hackware1993:MagicIndicator:1.5.0'
          implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.70'
          implementation 'org.jsoup:jsoup:1.11.3'
          implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
          implementation 'com.google.firebase:firebase-messaging:20.1.4'
          implementation 'com.google.firebase:firebase-core:17.3.0'
  
  
          implementation 'com.facebook.android:facebook-login:5.15.3'
          implementation 'com.facebook.android:facebook-android-sdk:5.15.3'
  
          // Circle Indicator
          implementation 'me.relex:circleindicator:1.2.2@aar'
          // ViewModel and LiveData
          implementation 'android.arch.lifecycle:extensions:1.1.1'
          // Lottie
          implementation 'com.airbnb.android:lottie:3.0.7'
  
  
          def work_version = "2.3.4"
  
          // (Java only)
          implementation "androidx.work:work-runtime:$work_version"
  
          androidTestImplementation "androidx.work:work-testing:$work_version"
  
  
          api 'com.google.android.gms:play-services-auth:17.0.0'
          implementation 'com.adjust.sdk:adjust-android:4.16.0'
          implementation 'com.google.firebase:firebase-auth:19.3.0'
  
  
          api 'com.startapp:inapp-sdk:3.9.3'
          api('com.mopub:mopub-sdk-banner:5.1.0@aar') {
              transitive = true
              exclude module: 'libAvid-mopub' // To exclude AVID
              exclude module: 'moat-mobile-app-kit' // To exclude Moat
          }
          // For interstitials
          api('com.mopub:mopub-sdk-interstitial:5.1.0@aar') {
              transitive = true
              exclude module: 'libAvid-mopub' // To exclude AVID
              exclude module: 'moat-mobile-app-kit' // To exclude Moat
          }
          api('com.mopub:mopub-sdk-native-static:5.1.0@aar') {
              transitive = true
              exclude module: 'libAvid-mopub' // To exclude AVID
              exclude module: 'moat-mobile-app-kit' // To exclude Moat
          }
          api 'com.instal:instal-publisher-sdk:1.0.26'
          api fileTree(include: ['*.jar'], dir: 'libs')
          api 'org.jsoup:jsoup:1.11.3'
          api 'com.squareup.picasso:picasso:2.71828'
          api 'com.google.code.gson:gson:2.8.5'
          api 'com.inmobi.monetization:inmobi-ads:8.1.1'
          api project(':gdpr')
  
          api 'com.google.firebase:firebase-iid:20.1.4'
          api 'com.google.firebase:firebase-core:17.3.0'
          api 'com.google.firebase:firebase-storage:19.1.1'
          implementation 'com.google.firebase:firebase-dynamic-links:19.1.0'
          implementation 'com.github.florent37:shapeofview:1.4.7'
          implementation 'com.google.firebase:firebase-inappmessaging-display:19.0.4'
          implementation 'com.google.guava:guava:27.0.1-android'
  
          api 'com.appnext.sdk:ads:2.4.2.471'
          api 'com.appnext.sdk:banners:2.4.1.471'
          api 'com.applovin:applovin-sdk:8.1.0'
          api 'com.google.android.gms:play-services-analytics:17.0.0'
          implementation 'com.google.firebase:firebase-analytics:17.3.0'
  
  
          api 'com.google.android.gms:play-services-ads:19.0.1'
  
  
          api(name: 'TremorVideo', ext: 'aar')
          api(name: 'unity-ads', ext: 'aar')
  
  
          api(name: 'advads-sdk', ext: 'aar')
  
  
          api 'androidx.media:media:1.1.0'
          api 'androidx.legacy:legacy-support-v4:1.0.0'
  
  
          api 'com.squareup.retrofit2:retrofit:2.8.1'
          implementation 'com.facebook.shimmer:shimmer:0.4.0'
          api 'com.squareup.retrofit2:converter-gson:2.8.1'
          api 'com.squareup.okhttp3:logging-interceptor:3.11.0'
          api 'com.squareup.retrofit2:adapter-rxjava2:2.8.1'
  
  
          api 'com.google.android.gms:play-services-location:17.0.0'
          //implementation(name: 'DuappsAd-CW-1.2.8.1-release', ext: 'aar')
          implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
          implementation(name: 'ads-librarry-android-release', ext: 'aar')
          api 'com.google.android.material:material:1.1.0'
  
          api 'com.facebook.android:audience-network-sdk:5.6.0'
          implementation 'com.twitter.sdk.android:twitter-core:3.1.1'
          implementation 'com.squareup.retrofit2:converter-scalars:2.8.1'
          implementation 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0'
          implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
          implementation 'io.reactivex.rxjava2:rxjava:2.1.14'
          api 'com.adcolony:sdk:3.3.11'
          api fileTree(include: [' admarvel-android-sdk-core.jar'], dir: 'libs')
          implementation 'com.github.bumptech.glide:glide:4.11.0'
          implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
          implementation 'com.google.android.gms:play-services-fitness:18.0.0'
  
          //implementation 'com.github.marcinmoskala:ArcSeekBar:0.31'
          implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
          implementation 'com.yarolegovich:discrete-scrollview:1.4.9'
          implementation 'com.google.firebase:firebase-dynamic-links:19.1.0'
          implementation 'androidx.appcompat:appcompat:1.1.0'
  
  
      }
      apply plugin: 'com.google.gms.google-services'
      compileOptions {
          sourceCompatibility = 1.8
          targetCompatibility = 1.8
      }
      defaultConfig {
          vectorDrawables.useSupportLibrary = true
      }
  }
  </code></pre>