One of the new features in android studio 2.2 preview 1
is APK Analyzer
and when you try it it give you statistics Defined Methods
and Referenced Methods
example output:
This dex file defines 4118 classes with 28823 methods,and references 35206 methods
You can see the Structure tab below your Project tab in Android Studio. Open your file in editor and click on structure tab, it will show all the methods in the class selected.
An APK file contains all of a program's code (such as . dex files), resources, assets, certificates, and manifest file. As is the case with many file formats, APK files can have any name needed, but it may be required that the file name ends in the file extension for being recognized as such.
Android Studio includes an APK Analyzer that provides immediate insight into the composition of your APK or Android App Bundle after the build process completes. Using the APK Analyzer can reduce the time you spend debugging issues with DEX files and resources within your app, and help reduce your APK size.
Defined methods are methods that you have written, or are using correctly based on the given situation. If a method is referenced, it only means that you (or other methods/objects in your code) are calling them. However, just because a method is referenced doesn't mean that their is anything defined for it, or it could be defined incorrectly. If example you're using open source libraries that may have been installed incorrectly (I have done this way too many times) you'll get a ton of referenced methods with nothing defined for them. Hope that helps!
I know this is an old answer but I'll just paste a snippet of what both terms mean from the official website and what gets count toward the 64k limit.
Each package, class, and method inside the DEX file has counts listed in the Defined Method and Referenced Methods columns. The Referenced Methods column counts all methods that are referenced by the DEX file. This typically includes methods defined in your code, dependency libraries, and methods defined in standard Java and Android packages that the code uses—these are the methods counted toward the 64k method limit in each DEX file. The Defined Methods column counts only the methods that are defined in one of your DEX files, so this number is a subset of Referenced Methods.
Reference: https://developer.android.com/studio/build/apk-analyzer#view_dex_files
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With