<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Mayur Mohapatra on Medium]]></title>
        <description><![CDATA[Stories by Mayur Mohapatra on Medium]]></description>
        <link>https://medium.com/@mayurmohapatra?source=rss-27ea251e2444------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*KJ_J-Yy1qKs0bo1YujS7SA.jpeg</url>
            <title>Stories by Mayur Mohapatra on Medium</title>
            <link>https://medium.com/@mayurmohapatra?source=rss-27ea251e2444------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 09:41:49 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mayurmohapatra/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[We achieved a 75% reduction in our android app download size! Here’s how…]]></title>
            <link>https://tech.oyorooms.com/75-percent-reduction-in-our-android-app-download-size-1ca15d6eb305?source=rss-27ea251e2444------2</link>
            <guid isPermaLink="false">https://medium.com/p/1ca15d6eb305</guid>
            <category><![CDATA[development]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[app-size]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Mayur Mohapatra]]></dc:creator>
            <pubDate>Tue, 23 Mar 2021 05:52:04 GMT</pubDate>
            <atom:updated>2021-03-23T05:52:04.006Z</atom:updated>
            <content:encoded><![CDATA[<p>This is a story about how we went from a bloated <strong>26.8MB</strong> sized app on the play store to one that serves at <strong>6.7MB</strong> now. Surprised? <a href="https://play.google.com/store/apps/details?id=com.guerrilla.innov8coworking">Why not see for your yourself?</a></p><p>The <a href="https://play.google.com/store/apps/details?id=com.guerrilla.innov8coworking"><strong>OYO Workspaces app</strong></a> is fairly simple in nature. A couple of screens, a couple of network calls and some booking logic sprinkled about… So why would this need a whooping 26.8MB? This was gnawing at the back of our heads until we decided to do something about it..</p><p>Before we dig into what we did, here’s what we’re all about -<br>OYO Workspaces is helping Startups, Freelancers, Entrepreneurs and corporate businesses thrive in collaborative, cost effective and aesthetic workspaces. The app aims at providing meeting room bookings at your fingertips, lightning fast support and serves as a one-stop destination for all your coworking needs.</p><figure><img alt="What OYO Workspaces is all about." src="https://cdn-images-1.medium.com/max/1024/1*lryjo6UXW1jg7tDGcOBtFA.png" /></figure><p>Right, now lets see how we achieved the 75% reduction in our app size (<em>there’s a tl;dr at the bottom for all the devs who’re short on time</em>) -</p><h4>.apk -&gt; .aab</h4><p>Anyone who’s ever worked with Android knows what an apk file is.. for the rest of us, an apk file is what the Android system uses for distributing and installing mobile applications. So pretty much an apk contains all the things an Android device would need to install your app. Sounds simple right?</p><p>Then whats an aab? <em>*cues drum roll*</em> A .aab file is an <a href="https://developer.android.com/platform/technology/app-bundle"><strong>Android App Bundle</strong></a>. It’s an ingenious thing that the engineers over at Google have come up with that allows us to build modular apps with faster build times, lesser download size and optimise releases. Sounds not so simple right? Have a look at the image below.</p><figure><img alt="composition of an android app bundle" src="https://cdn-images-1.medium.com/max/1024/1*mvZL-h7SA8h375DyDioC0g.png" /><figcaption>Composition of an Android App Bundle</figcaption></figure><p>So we can see that the bundle doesn’t simple comprise of a singular apk but rather supports apk generation for a bunch of different specifications.</p><ul><li>We’ve got APKs for individual ABIs. ABI is the interface used to communicated with the CPU, and since Android devices have a plethora of different types of CPUs, we have various ABIs. You can read more on this <a href="https://developer.android.com/ndk/guides/abis"><strong>here</strong></a></li><li>We’ve got customised APKs for different screen types. Think of this as a form of asset management where we wouldn’t want to deliver high quality assets (images for example) to a device that can only support upto medium quality assets.</li><li>We’ve got customised APKs for languages. Because.. well let’s face it.. most users will not need multi-language support.</li></ul><p>And so we’ve got a very tailored setup where we can deliver only what the user needs and nothing further.</p><p>Android App Bundles provide multiple other benefits as well but as the scope of this article is on app size reduction, those benefits will not be covered here.</p><h4>minifyEnabled &amp; ProGuard</h4><p>This is something of a double edged sword. While it can greatly benefit your app, it can also cause your app to tumble down crashing. Let’s see what they do -</p><p>minifyEnabled is a way for us developers to instruct the R8 engine to perform tree shaking ( a way of detecting unused code ) and remove them from our generated codebase. The R8 engine detects all entry points into your application and from there build a graph that links all the code your app can reach during runtime. In the end anything thats not a part of this graph is removed.</p><p>However, sometimes this might lead to some parts of a dependency module being marked as dead code leading to its removal which needless to say will result in a buggy app. Here comes ProGuard to our rescue. ProGuard lets us specify a configuration to the R8 engine on what parts of the code should not be touched. It also provides a host of additional features that you can look at <a href="https://www.guardsquare.com/en/products/proguard/manual/usage"><strong>here</strong></a></p><h4>Google Size Analyzer</h4><p>This a tool that lets you see what are individual size taking components inside of your bundle. Although it’s not being actively maintained, it still does a fantastic job. You can get the tool from <a href="https://github.com/android/size-analyzer">here</a>.</p><p>After installing and extracting the tool you can simply</p><pre>./size-analyzer check-bundle &lt;path-to-aab&gt; -d</pre><p>for the tool to check out your bundle. Here’s a preview of what you can get :</p><figure><img alt="Output from the size analyzer tool" src="https://cdn-images-1.medium.com/max/1024/1*lzolhR6rsXWSR0SjAvQnjA.png" /><figcaption>Output of the Size Analyzer ( Files hidden so that I don’t get into trouble :) )</figcaption></figure><p>So right off the bat we can see that this is quite a handy output. Not only does it provide file specific size info but also suggestions on how to mitigate the issue.</p><p>There are two main type of issues to be highlighted here that will be common for a majority of apps :</p><ul><li>Unused assets : You might find that your application has a lot of fonts and images that have been added over the application’s lifecycle that are not required anymore. Well time to get rid of them.</li><li>Unoptimised assets : We tend to simply copy over the asset provided by the design/brand team into our application not giving some thought over its size. You can more often than not reduce your asset sizes drastically by compressing them. You can use a .webp converter to convert your .png/.jpeg assets to .webp and save you a lot of space, but be aware that webp might not be supported on all devices. An alternative here is to compress your base asset. (A recommended tool would be <a href="https://tinypng.com/">tinypng</a>)</li></ul><p>Apart from these two issues, you might come across further optimisation suggestion from the size analyzer.</p><p>At this point we’ve got a tailored APK for each device, we’ve got rid of code that we don’t need and we’ve optimised our assets and so, we can be happy on what we’ve accomplished.</p><p>What we’ve covered till now is framework independent - be it a React Native App, Flutter App, a Native Android App or based off of any other framework, you can employ these to achieve quite a big decrease in your app download size.</p><p>Since our app was built using React Native, we’d like to highlight another tool we used specific to React Native to further enhance the app size.</p><h4><a href="https://www.npmjs.com/package/react-native-bundle-visualizer"><strong>react-native-bundle-visualizer</strong></a></h4><p>If you’ve ever built something for the web, chances are that you’ve taken a look at your js bundles at some point or the other. Well what if I told you that you can do the same for your React Native application as well.</p><p>This tool generates a foam-tree dependency output where you can get a glimpse of the biggest culprit in your JS Bundle.</p><p>Although the changes here might not lead to any big drop of app size, it serves another benefit — the smaller your JS Bundle, the faster your app loads up which is something every developer should be concerned about.</p><p>So there we have it folks! By using the above methods, we achieved a <strong>75%</strong> reduction in our app download size.</p><blockquote><strong>tl;dr as promised<br></strong>→ Ditch the traditional .apk in favour of <a href="https://developer.android.com/platform/technology/app-bundle"><strong>.aab</strong></a><strong><br></strong> → minifyEnabled &amp; ProGuard to the rescue.<br>→ <a href="https://github.com/android/size-analyzer"><strong>Google Size Analyser</strong></a> for deeper insights <br>→ Dependencies analysis with <a href="https://www.npmjs.com/package/react-native-bundle-visualizer"><strong>react-native-bundle-visualizer</strong></a></blockquote><blockquote><strong>Deep Dive </strong><br>→ <a href="https://developer.android.com/studio/build/shrink-code">Android recommendations on code shrinking, optimisation &amp; obfuscation</a><br><strong>→</strong> <a href="https://developer.android.com/platform/technology/app-bundle">App Bundle</a><br>→ <a href="https://www.guardsquare.com/en/products/proguard/manual/usage">ProGuard</a><br>→ <a href="https://developers.google.com/speed/webp">WebP</a></blockquote><p>Liked the read? Leave behind a clap, or even better, try our app out and leave a feedback.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1ca15d6eb305" width="1" height="1" alt=""><hr><p><a href="https://tech.oyorooms.com/75-percent-reduction-in-our-android-app-download-size-1ca15d6eb305">We achieved a 75% reduction in our android app download size! Here’s how…</a> was originally published in <a href="https://tech.oyorooms.com/">OYOTech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Figuring out TypeScript // What  is Typing ?]]></title>
            <link>https://mayurmohapatra.medium.com/figuring-out-typescript-what-is-typing-8ab9c19f7beb?source=rss-27ea251e2444------2</link>
            <guid isPermaLink="false">https://medium.com/p/8ab9c19f7beb</guid>
            <category><![CDATA[code]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Mayur Mohapatra]]></dc:creator>
            <pubDate>Tue, 23 Mar 2021 04:40:17 GMT</pubDate>
            <atom:updated>2021-03-23T04:40:17.443Z</atom:updated>
            <content:encoded><![CDATA[<h3>Figuring out TypeScript // Typing System Overview ⚡️</h3><blockquote>I ditched JavaScript for its sibling TypeScript and I am now both confused and scared.</blockquote><blockquote>Join me in this crazy bug-filled journey as I dig deeper into TypeScript ..</blockquote><h4><strong>What is TypeScript?</strong></h4><blockquote>Typed JavaScript at Any Scale</blockquote><p>This is what the folks over at <a href="https://www.typescriptlang.org/">the official website</a> have to say. Makes little to no sense? Thought so. Let’s go ahead and break this down.</p><h4><strong>Typing Systems</strong></h4><p>Here Typing refers to the data type of any variable. Let’s go over the major ways of typing that we can use to describe a programming language’s type system.</p><p><strong>Strongly Typed vs. Weakly Typed</strong></p><pre>#Python<br>stronglyTypedVar = &quot;ben&quot;<br>stronglyTypedVar += 10<br>print(stronglyTypedVar)</pre><pre>TypeError: cannot concatenate &#39;str&#39; and &#39;int&#39; objects</pre><p>Here we are specifying that stronglyTypedVar is bound as a string., and hence when we try to add an integer to it we get a TypeError. This form of typing is a strongly-typed system.</p><p>In contrast to the stronglyTypedVar above, weaklyTypedVar allows us to perform the same operation even though the data types are different. The following snippet shows us a weakly-typed system.</p><pre>//JS<br>weaklyTypedVar = &quot;ben&quot;<br>weaklyTypedVar += 10<br>console.log(weaklyTypedVar)</pre><pre>ben10</pre><p><strong>Static Typing vs. Dynamic Typing</strong></p><pre>//JAVA</pre><pre>String staticTypedVar;<br>staticTypedVar = &quot;foo&quot;;<br>System.out.println(staticTypedVar);</pre><pre>foo</pre><p>Static Typing on the other hand states that we cannot declare variables without providing a specific type or rather that the data type needs to be static during execution.</p><p>On the other hand a dynamic typing system allows us to declare variables on the fly without having to specify a definitive type. Here’s a snippet.</p><pre>//JS<br>dynamicTypedVar = &quot;foo&quot;<br>console.log(dynamicTypedVar)</pre><pre>foo</pre><p>Now that we have an idea of what typing is, let’s look at the next thing : <strong>JavaScript</strong>.</p><p>JavaScript is a <strong>dynamic typing</strong> language, so this means we can declare variables without specifying its type.</p><p>So now when we put two and two together we get something like this…</p><pre>//TS<br>let typeScriptVar : string = &quot;foo&quot;;<br>console.log(typeScriptVar)</pre><pre>foo</pre><p>Voila! You’ve now declared a variable typeScriptVar of type string. And if you were to assign it a value of any other type you will get an error.</p><pre>error TS2322: Type ‘number’ is not assignable to type ‘string’. </pre><h4>Example</h4><p>Perhaps a pseudo example will make it clear. Picture an application that lets you manage the inventory in your shop.</p><p>Lets say we have an API that gives us the inventory information like so —</p><pre>[<br>  {<br>    &quot;name&quot;: &quot;Chocolate Box&quot;,<br>    &quot;description&quot;: &quot;Box of chocolates&quot;,<br>    &quot;variants&quot;: [&quot;100g&quot;,&quot;200g&quot;,&quot;500g&quot;]<br>  },<br>  {<br>    &quot;name&quot;: &quot;Flowers&quot;,<br>    &quot;description&quot;: &quot;Bouquet of Flowers&quot;,<br>    &quot;variants&quot;: null<br>  },...<br>]</pre><p>Now in our application we can use this API contract to model the expected structure of an inventory item as an object that contains the fields name, description, variants with their respective types being string, string, string[] or undefined .</p><pre>type InventoryItem = {<br>  name: string<br>  description: string<br>  variants: string[] | undefined<br>}</pre><p>What this does is it helps us know what keys are expected in a data-type and also if a key can have a possible undefined value during run-time. This helps us escape the infamous</p><pre>TypeError: Cannot read property &#39;foo&#39; of undefined</pre><h4>Wrapping Things Up</h4><p>So all in all TypeScript lets us use JavaScript and provides us with a way to specific the datatype that is expected in the variable. Moreover, TypeScript isn’t just limited to primitive datatypes (number, string, boolean … ) but rather it lets us define complex structures with relative ease as well.</p><p>You might think that well thats an awful lot of extra work just to avoid an error, and let me tell you this.. Yes! It is a lot of work.. but is it awful? No! In my opinion <strong><em>it’s worth its weight in code</em></strong>. 😉</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8ab9c19f7beb" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>