Android Kaki

Build beautiful, usable products using required Components for Android.

App Dimension Metrics – Steady Monitoring App Dimension, Half 3 | by Akash Khunt | June 2023


Akash Khunt

ProAndroidDev
photograph taken by Sven Mieke ABOVE go away

IN Half 2, we accomplished our GHA workflow to generate apk measurement diff report after which added it as remark for PR. On this submit, we are going to implement the same workflow however utilizing a plugin known as Ruler and in addition contemplate a few of its further options.

Let’s rewind a little bit to Half 1, the place we mentioned once we need to cut back apk measurement, we attempt to have a look at the scale contribution by every excessive stage class (e.g. .dex recordsdata, assets, property, JNI libraries) ). An much more superior stage in “Scale back Apk Dimension” the train is to grasp the contribution of third occasion SDKs (this isn’t a trivial activity 😅). One of many methods to calculate it could possibly be to create two apps with and with out the SDK, after which calculate the distinction. However that is very time consuming and handbook course of.

That is the place Spotify Ruler plugin could be very helpful as a result of it gives detailed details about the scale contributed by every module and the dependencies current in your software 😲. You may verify the pattern report generated with the assistance of Ruler plugin within the screenshot beneath.

Ruler show report Obtain (left aspect) & Settings (proper aspect) measurement contributions of all third occasion SDKs and modules

One downside that I’ve when utilizing the Ruler plugin is that it incompatible with config-cache. However it isn’t a blocker as you may at all times disable the configuration cache setting by switching “ — no config-cache” flag whereas working Ruler-level duties.

Integrating this plugin could be very easy and doesn’t require a lot effort. When this plugin is built-in, it should present analyze{BUILD_VARIANT}Bundle class activity. For an app with no customized construct variant it should present two duties i.e. analyzeDebugBundle & analyzeReleaseBundle. An essential function of this plugin apart from exhibiting measurement contribution, is exhibiting possession of various modules in your software. I extremely advocate you to attempt.

When you run this evaluation gradle then it should generate two recordsdata i.e. HTML report and json file. The HTML report is a extra readable report that you need to use to visually verify the scale contribution. You may see the same pattern report beneath:

HTML report template

The file we’re extra considering is the json report. Since we will course of the content material of this json file to generate extra information within the format we would like. The json file content material seems like within the screenshot beneath:

json report template

So our purpose right here is to course of the json file content material and generate the identical sort of report we created earlier. The top consequence will seem like beneath:

Remark Dimension distinction report added by our workflow (utilizing Ruler plugin)

We shall be creating a brand new workflow that’s similar to the one we created earlier.

This workflow can also be damaged down into three jobs:

  • Generate html+json studies for each base department and merge department (i.e. head department + base department)
  • Generate measurement distinction report (utilizing customized python script)
  • Add measurement distinction report as PR remark (similar as earlier workflow)

Generate Python Script (to parse json report)

Python script to parse json report generated by Ruler plugin

The principle distinction on this script from the earlier one is the content material of get_apk_components operate. Right here we not have to make use of apk analyzer stuff and simply loop by means of json_data (parsed from studying json report generated with Ruler plugin) and replace the content material of the parts dictionary.

Ruler reporting course of

This workflow can also be similar to the earlier one with some minor changes in construct work (as a substitute of doing assemblyRelease quests and uploads apk we are going to do it analysisReleaseBundle quests and uploads html & json studies) & size_report work (utilizing an up to date python script that does not require the apkanalyzer software). Last match pr_comment the job stays the identical in each workflows as a result of the enter file will nonetheless be Ruler_diff_report.html file and we are going to use its contents so as to add feedback on the PR.

Conclusion

Results of each size_metrics.yml & Ruler_report.yml the workflow is similar aside from the truth that the latter additionally renders the html report permitting us to do some extra detailed/deep stage investigation of the scale contribution visually.

John Wick: Chapter 4 (FREE) FULLMOVIE The Super Mario Bros Movie avatar 2 Where To Watch Creed 3 Free At Home Knock at the Cabin (2023) FullMovie Where To Watch Ant-Man 3 and the Wasp: Quantumania Cocaine Bear 2023 (FullMovie) Scream 6 Full Movie
Updated: June 22, 2023 — 11:06 pm

Leave a Reply

Your email address will not be published. Required fields are marked *

androidkaki.com © 2023 Android kaki