How to check the size of dependencies in an android app?

If anyone stumbles on this post, here is an even easier way to check.

All you have to do is compile your APK normally, take note of the size, then replace "implementation" for "compileOnly" in the library you want to check in your build.gradle.

This will generate an APK that crashes on runtime because it does not contain the library, but you can use it to compare and get the size said library adds to your APK.


In new Android Studio you can navigate build/outputs/apk folder double tap on apk file you are interested (there should be separate file for each flavor) It will open a view like this: enter image description here there is lib folder where you can check a size of each library. also you can se a size of resources and other stuf.


I don't know whether it helps you or not but I researched and found this.

select the project from the dropdown. go to your project. now select the libraries. right-click on the library you want to see the detail. choose the file path and click on the libraries or you can choose your dependency library. and go to the directory as shown in the figure below

enter image description here

enter image description here

enter image description hereenter image description here

Updated answer

With the latest android studio, you can see the size of apk with apk analyzer very powerful tool to analyze the apk.

  1. select Build from the menu and then select Analyze APK..
  2. give the path to the desired apk and press ok.

now you can review the size of all the files you want to.

output

Tags:

Android

Gradle