What is Android MultiDex?

Quoting the documentation: Android application (APK) files contain executable bytecode files in the form of Dalvik Executable (DEX) files, which contain the compiled code used to run your app. The Dalvik Executable specification limits the total number of methods that can be referenced within a single DEX file to 65,536, including Android framework methods, library … Read more

How to shrink code – 65k method limit in dex

It looks like Google has finally implementing a workaround/fix for surpassing the 65K method limit of dex files. About the 65K Reference Limit Android application (APK) files contain executable bytecode files in the form of Dalvik Executable (DEX) files, which contain the compiled code used to run your app. The Dalvik Executable specification limits the … Read more

The number of method references in a .dex file cannot exceed 64k API 17

You have too many methods. There can only be 65536 methods for dex. As suggested you can use the multidex support. Just add these lines in the module/build.gradle: android { defaultConfig { … // Enabling multidex support. multiDexEnabled true } … } dependencies { implementation ‘androidx.multidex:multidex:2.0.1’ //with androidx libraries //implementation ‘com.android.support:multidex:1.0.3’ //with support libraries } … Read more

Error:Cannot fit requested classes in a single dex file.Try supplying a main-dex list. # methods: 72477 > 65536

None of the answers they gave you was exhaustive. The problem lies in the Multidex. You must add the library in the app gradle : implementation ‘com.android.support:multidex:1.0.3’ After, add in the defaultConfig of the app gradle : multiDexEnabled true Your Application must be of the Multidex type.. You must write it in the manifest : … Read more

Error:Execution failed for task ‘:app:transformClassesWithDexForDebug’

Just correct Google play services dependencies: You are including all play services in your project. Only add those you want. For example , if you are using only maps and g+ signin, than change compile ‘com.google.android.gms:play-services:8.1.0’ to compile ‘com.google.android.gms:play-services-maps:8.1.0’ compile ‘com.google.android.gms:play-services-plus:8.1.0’ From the doc : In versions of Google Play services prior to 6.5, you … Read more

How to enable multidexing with the new Android Multidex support library

Edit: Android 5.0 (API level 21) and higher uses ART which supports multidexing. Therefore, if your minSdkVersion is 21 or higher, the multidex support library is not needed. Modify your build.gradle: android { compileSdkVersion 22 buildToolsVersion “23.0.0” defaultConfig { minSdkVersion 14 //lower than 14 doesn’t support multidex targetSdkVersion 22 // Enabling multidex support. multiDexEnabled true … Read more