0

What problems can I face while extending methods limit with multi-dex? Is it okay to use it?

Alexandr
  • 3,859
  • 5
  • 32
  • 56

2 Answers2

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:

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