androiddex

What is 64K method counts limit for an Android application and their graph of connection


I have seen this error in Android app and have seen many posts on stackoverflow like Link but have not got exactly the meaning of 64K method counts limit of an Android application

What exactly this limit means , is it the User defined methods or overall imported methods too from classes

If yes ... how can I see the graph of reference of methods connected .


Solution

  • The limit also counts all the method that you add with your build.gradle, and your custom classes too. By default all your classes are compiled to a single classes.dex file. That file can only contain up to 64K (i.e. 64 * 1024 = 65536) methods. When you add a multi Dex support in your build.gradle, you allow it to compile the classes into multiple Dex files and be referred from their respective Dex files.

    You can get the reference and methods of your apk file in Android studio and check which methods are taking how much space.