a). Why do I need to add Multidex Support Library?
-> The purpose of this is to split up your Dex file into multiple Dex files.This library provides support for building apps with multiple Dalvik Executable (DEX) files. Apps that reference more than 65536 methods are required to use Multidex configurations.
b). What's the future purpose?
-> Android has a problem whereby there is an upper limit on the number of method definitions in a Dex file (64k). This means that once that limit is reached, you cannot expand your application any further.
Before Multidex, it was advised to use ProGuard to reduce the number of method definitions by removing methods that aren't used in the code. Especially useful when implementing the Google Play Services Framework.
Multidex was then introduced and allows Apps to continue to expand without worrying about method count limits. It does carry the danger of making the App more unstable. Therefore it is advised to try ProGuard first to reduce the method count.
c). What does the second error mean?
java.lang.UnsupportedOperationException
Ref: https://stackoverflow.com/a/21061985/3758024
Please provide the complete crash log/stack trace of this crash from your app with the relevant code snippet.
d). In what sense it say that .dex file cannot exceed 64K? Can you help me?
-> Android app (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 methods, and methods in your own code. In the context of computer science, the term Kilo, K, denotes 1024 (or 2^10). Because 65,536 is equal to 64 X 1024, this limit is referred to as the '64K reference limit'.
More References.
1) https://developer.android.com/studio/build/multidex.html#avoid
2) https://medium.com/@rotxed/dex-skys-the-limit-no-65k-methods-is-28e6cb40cf71#.3eg897jca
3) https://blog.mustafaali.xyz/dexs-64k-limit-is-not-a-problem-anymore-well-almost-2b1faac3508#.wiaruldue
4)http://www.fasteque.com/deep-dive-into-android-multidex/