-3

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 .

Yatin
  • 2,969
  • 9
  • 34
  • 68
  • 1
    https://developer.android.com/studio/build/multidex.html – Mohit Feb 15 '18 at 10:07
  • does it mean thats the limit for number of user specified methods and multidex – Yatin Feb 15 '18 at 10:09
  • 1
    It means all methods inside dex file, include different libraries. Prior to Android 5 APK can contains only one dex file, after that few ones(multidex) – anber Feb 15 '18 at 10:12
  • It is the limit of total number of methods that can be referenced within a single DEX file – Rudrik Patel Feb 15 '18 at 10:17

1 Answers1

4

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.

evandrix
  • 6,041
  • 4
  • 27
  • 38
Minasie Shibeshi
  • 390
  • 3
  • 16