What are the dex method and string limits in an Android app?

假装没事ソ 提交于 2019-12-13 06:49:23

问题


After implementing jumbo dex, we dont get any further dex errors. The ~65K string limit is now exceeded, but not the method count. What is the limits we now face, if any, for strings and methods in an Android app?


回答1:


After some exhaustive testing. The details can be found below:

  • The upper limit on method references and string references without jumbo dex is 65536.
  • A method reference is a unique name by which a method is defined and/or invoked, and is only counted once. That is to say:
    • if you call an externally defined method (e.g.. something in the core Java runtime) once, that’s one reference
    • if you call it again, it’s still only one reference
    • If you define a method, that’s one reference
    • If you call the same method, it’s still only one reference
  • A string reference is any unique string literal. Note this includes strings defined in resources that become literals in R.
  • Jumbo dex doesn’t seem to have an effect via project.properties (or perhaps both Jon and I are doing it wrong), but it does appear to work in both local and server builds
  • With jumbo dex on, the string reference limit is somewhere between 110K and 120K.
  • With jumbo dex on, the method reference limit is still 65536 (confirmed!!)


来源:https://stackoverflow.com/questions/24634321/what-are-the-dex-method-and-string-limits-in-an-android-app

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!