What is meant by "multiDexEnabled true" in Android gradle. Why do we use this? What is the effect if it is enabled?
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
It allows you to build apps with over 64k methods. For more information see here http://developer.android.com/intl/es/tools/building/multidex.html
multidex support third party library to your application
If minSdkVersion >= 21 then you can enable it by writing multidexEnabled = true if minSdkVersion <21 then you will have to include Multidex Compatibily library in your gradle. See more on enabling multidex support
Android applications by default have SingleDex support which limits your application to have only 65536 methods(references). So multidexEnabled = true simply means that now you can write more than 65536 methods(references) in your application.
But I will never write 65536 methods!
When we say the number of methods, it means
I have read somewhere in a post that
App Compat 24.2.1 contains 16.5k methods
Google Play Services GCM 9.6.1 contains 16.7k methods.
So if you have just written a simple Hello world application which has App Compat 24.2.1 then your application is already having 16.7k methods.
How to enable multidex support
If minSdkVersion >= 21 then you can enable it by writing multidexEnabled = true
if minSdkVersion <21 then you will have to include Multidex Compatibily library in your gradle.
See more on enabling multidex support
Advantage of multiDex
multidex allows your applications to have more third-party libraries.
More on .dex files
Android applications are compiled into a .dex file/files which in turn zipped to a single .apk file. .dex files have bytecodes which are used by Dalvik Virtual Machine(DVM).
You can read more on .dex and DVM
You should read official guide line about Building Apps with Over 64K Methods