Android apps, when packaged in a dex file, have a hard limit

Question:

Android applications, when packaged in a dex file, have a hard limit of 65536 reference methods. what does that mean? and how to find out how many reference methods I have?

Answer:

  • what does that mean?

this means Dalvik 65K methods limit:

You can refer to a very large number of methods in a DEX file, but you can only call the first 65536 because that's all the memory you have for a method call instruction. […] the number of methods you can refer to is limited, not the number of methods you define. In other words, if your DEX file contains only a few methods, but together they call 70,000 different externally defined methods, you will exceed the limit.

  • and how to find out how many reference methods I have?

alternatively with dex-method-counts


source

Scroll to Top