What problems can I face while extending methods limit with multi-dex? Is it okay to use it?
Asked
Active
Viewed 696 times
0
-
Yes it's perfect to use. – Yasir Tahir May 16 '16 at 09:28
-
Read more at http://stackoverflow.com/a/26724685/5392825 – Yasir Tahir May 16 '16 at 09:45
2 Answers
2
Must I avoid using multidex and keep myself under 65k methods limit?
Answer is there is no restriction about this that whether you use multidex or not. But if your app cross the 65k limit then you need to add multidex support. And yes it is ok to use it.

Sayem
- 4,891
- 3
- 28
- 43
1
I recommend to avoid using multidex because:
- Instant run doesn't work with it.
- Building takes more time.
- On non-ART devices apps become slower.
There is very good feature of proguard, which can be used to fix this as it removes unused code.
Proguard config:
-ignorewarnings
-keep class !com.google.android.gms.**, !com.google.protobuf.**, !com.firebase.**, !com.urbanairship.** { *; }
-dontobfuscate
-dontwarn
Steps to use:
- Analyze your dex with https://github.com/google/android-classyshark
- Found packages with a lot of methods
- Include it to
-keep class
in proguard config
I reduced the method count with this approach from 67K to 45K methods.
Don't forget to add this config for both debug and release configurations.

wbk727
- 8,017
- 12
- 61
- 125

Vlad Sumtsov
- 209
- 3
- 7