What is the dex method and line restrictions in an android app?

After implementing jumbo dex, we get no additional dex errors. The ~ 65K line limit is now exceeded, but not the number of methods. What are the limitations that we encounter, if any, for strings and methods in an Android app?

0
android dex
source share
1 answer

After some comprehensive testing. Details can be found below:

  • The upper limit of method and string references without jumbo dex is 65536.
  • A method reference is a unique name by which a method is defined and / or called and counted only once. I.e:
    • if you call an externally defined method (e.g. something in the main Java environment) once, this is one reference
    • If you call him again, his another link
    • If you define a method, this is one link
    • If you call the same method, its another reference
  • A string reference is any unique string literal. Note that this includes strings defined in resources that become literals in R.
  • Jumbo dex doesn't seem to have an effect through project.properties (or maybe John and I are doing it wrong), but it seems to work in both local and server builds
  • When using jumbo dex, the link restriction is a line somewhere between 110K and 120K .
  • When using jumbo dex link limitation still 65536 (confirmed !!)
+3
source share

All Articles