spotify / ruler

Gradle plugin which helps you analyze the size of your Android apps.
Apache License 2.0
1.13k stars 58 forks source link

Discrepancy in install size #93

Open MrHadiSatrio opened 2 years ago

MrHadiSatrio commented 2 years ago

Current behavior

There is a discrepancy in readings for install size. Running sample:app:analyzeDebug yields 620.9 KB on the report, while "App size" readings on device shows 676 KB.

Device configurations are synced with the result of bundletool get-device-spec.

Ruler Report On Device
Screen Shot 2022-08-19 at 10 39 45 Screen Shot 2022-08-19 at 10 39 45

I'm also observing a bigger diff of almost 3x (62.8 MB reported vs 192 MB on-device) on my project.

Expected behavior

There shouldn't be that big of a difference between the number Ruler reports for Install Size and the actual readings on a device.

Steps to reproduce

  1. Ensure that Ruler is properly setup to run with the target device configuration
  2. Run ./gradlew sample:app:analyzeDebugBundle
  3. Run ./gradlew sample:app:installDebug
  4. Observe the numbers reported and one from App Info screen

Versions

Anything else?

No response

simonschiller commented 2 years ago

What numbers does Android Studio report when you analyze the APK files with that? I suspect that this could have something to do with the way the APK is built when you run installDebug - which might be different than the mechanism we are using (running bundleDebug, then using bundletool to extract the correct APKs and then analyzing those APKs with the APK Analyzer).

MrHadiSatrio commented 2 years ago

Sorry for the long delay... I tried analyzing the AAB and the number matches Ruler's output. However, the APKs generated by bundletool tell a different story.

\ Ruler AAB APKs (base-master.apk + base-xxhdpi.apk)
Download Size 617.5 KB 617.8 KB 612.8 KB + 1.3 KB
Install Size 620.9 KB 620.5 KB 615.4 KB + 1.3 KB

Granted, the difference isn't that massive here. But from my findings, whatever it is the cause, it'd scale alongside the overall project size.

simonschiller commented 2 years ago

Is this reproducible in some open source project where we can try it out? It would be interesting to see the differences for each file to see if all of them are off by a little bit of if it's only a few files that have a discrepancy.