How To Reduce App Size: 9 Ways to Decrease Application Size to Make Slim And Trim

Last Updated
reducing app size

How To Reduce App Size: Bulky Apps are unpopular. The space on a user’s smartphone is a premium. There are limitations of bandwidth and storage. To ensure your app stays for a longer period on your user’s smartphone, the app size needs to be small. It should not take too much space. Apps with bigger sizes get uninstalled sooner due to space constraints. Small-sized apps rule smartphones.

App stores have prescribed their own constraints. For Google Play, APK size needs to be of 50 MB or less. It allows for 2GB expansion files. For App Store (iOS) the App size limit is 100MB.

How to Reduce App Size of iOS & Android?

So, how do you reduce App size of android and iOS apps? Let’s find out the ways.

1. Use ProGuard (Android)

ProGuard optimizes your Android Code. It is a free Java class file shrinker, preverifier, optimizer, and obfuscator with a template-based configuration. It removes unused Java codes and instructions from dependencies.

It optimizes byte codes by making them compact. It is a command-line tool with an optional graphical interface. It has plug-ins for Ant, for JME Wireless Toolkit, and for Gradle. It is fast and can process libraries and programs of several megabytes in seconds.

2. Use Resource Shrinking Tool (Android)

Resource Shrinking tool automatically removes resources that are unused at build time. Resource shrinking works only when combined with the code shrinking tool ProGuard. With the help of the tool, you can also get a diagnostic output printed to understand why a particular resource was removed or was not removed as the case may be.

Only nonvalue resources – drawable (.xml, .png, 9.png, etc.) menus, layouts, etc. are removed by the resource shrinker. It doesn’t remove resources that are defined in Values/folder – i.e. strings, dimensions, colors, styles, etc. remain untouched.

3. Use Static Code Analyzer

Lint is a static code analyzer that cleans your code. It is the original static code analyzer for C. It detects non-portable program files, unreachable statements, automatic variables declared and not used, loops not entered at the top, logical expressions with a constant value, functions whose values are not used, or whose values are used but none returned and bugs, etc.

Which can then be removed safely. Lint detects all unused resources and generates an HTML report. It doesn’t detect assets so the developer has to detect the unused files in the assets folder himself to keep it clean.

For Java, you could use JArchitect, SonarQube, an open-source platform for continuous inspection of code quality. Source meter is a platform-independent command–line static source code analyzer for Java, C/C++, RPG IV (AS/400), and Python. For C/C++ you can use an open-source compiler that includes a static analyzer.

There are several other tools used to analyze static code. You can view the list here.

4. Use Less Number of Architecture (Android)

Using iso stream increases the size of the architecture. You need to be careful of the iostreams and should use the android log print method. Limiting the number of architecture helps. When using native codes and native libraries stick to Armani and x86 architecture.

5. Compress the Images

Bitmap images are supported by Android in three .png, .jpg, and .gif. The images can be automatically optimized using lossless image compression by the aapt, Android Asset Packaging Tool during the build process. A True color PNG not requiring more than 256 colors can be converted to an 8 bit PNG with a color palette with the help of the tool.

The resultant image will be of the same quality but will be smaller in size and require less memory. Aapt helps to view, create and update zip compatible archives (zip, jar, apk).

There are several other tools like ImageAlpha, ImageOptim, PNG crush or pngquant that can help you with compression of images. You need to pick the tool that aligns with your workflow.

For backgrounds 9patch png (Android) can be used. It is a special format for png. 9Patch images can be especially used to design buttons.

You can also use WebP format. WebP is a new image format that provides lossless and lossy compression for images on the web. When compared to PNGs, WebP lossless images are 26% smaller in size. When compared with JPEG images, WebP lossy images are 25-34% smaller in size compared to JPEG images at equivalent SSIM index.

6. Reuse your Code

To optimize and reduce the final size of your App, reuse your code wherever you can. For a smooth scrolling performance, you can reuse codes in a list view or recycler view.

Android provides for recoloring of assets for reuse by using android: tint, android: tint-mode, and the color filter. If there is a resource that is a rotated equivalent of another resource, you don’t need to package both the resources. You can use ‘Rotate Drawable’ to get the desired functionality.

Here collapse is the rotated equivalent of expanding. You can do away with  ic_arrow_collapse. You need to create a ‘RotateDrawable’ using ic_arrow_expand. This technique reduces the file size. Avoid duplication of resources and dependency.

7. Use App Thinning (iOS)

App Thinning is a new process by Apple that helps save space on user’s smartphones by removing the elements that are not needed by the user automatically from the app. When an app is uploaded to the store, iTunes Connect makes multiple versions of it behind the scene – One version for each type of device – one version each for iPad 2, iPad Air, iPhone 4S, iPhone 5, iPhone6, iPhone6s, iPhone6 plus, etc. and stores them all on the App Store.

If you want your app on the iPhone 5s device, the App store will give you the iPhone 5s version of the app. You will not get interface elements for an iPad in your app or the 32-bit code for an iPhone5 or earlier in your version of the app.

App thinning also provides on-demand resources (ODR). For example, if you download a game from the Apple store it will load the first 5 levels on the phone and keep the other levels waiting for you on the server. As you complete level 3, it will download three more levels up to level 6 and remove one or two levels – the ones you are through.

App Thinning helps keep the app size small.

8. Unpack And Scan IPA file (iOS)

IPA file is a program execution file and it includes binary for ARM structure and can only be installed on iOS device. If in an App the .ipa file is big and the size is confounding you, you can unpack it and browse it to find out the reason for the same. Sometimes even other files like. PSD files accidentally get included in the main project and the size of the IPA file increases.

In Android APK, the layouts sometimes contain XML files, which increase its size.

You can also look out for extra files like ‘headers’ or ‘read me’ which take extra space.

You can use the details given here.

9. Remove Debug Information

All debug-related information can be removed from the application. The application does not use the data in any manner. Debug information lying in the application occupies space and therefore it should be removed. It can be done easily if the debug information is enclosed in conditional blocks.

If your application is still in the development stage, it makes sense to keep the debug information in the application. If you are compiling a release built, you should remove the entire debug-related information, its symbols, etc. from native files.

In the recently held Google I/O 2017 several more tips were shared which can help you reduce the size of an android app. Details of the best practices to be used were also shared. I strongly recommend that you watch the video given below in its entirety.

Conclusion:

There are several helpful articles that can help you in your pursuit of keeping the size of your app small. You can read this one here.

This one here from Google is pretty comprehensive. It is important to keep the app size small. Larger-sized apps run the risk of losing an install. When the App size is smaller, it is easier and faster to download and install. It doesn’t occupy a lot of space on your smartphone and users don’t pick it up to uninstall just because they are running short on space. Users use the app and rate it well. So as a part of the mobile app development team whichever app you are currently developing, make sure you keep the size of the App file small. If you have more tips on reducing the size, do share in the comments section. We’d love to hear from you.

Adios, until next time!

Instagram Whitepaper

Get Quote

author
Siften Halwai
AUTHOR

In addition to serving as a Content Writer & Content Marketing Strategist, Siften Halwai is a certified Cambridge English: Business Vantage (BEC Vantage) who empowers to create content that his targeted audience loves to read and engage with. His IT educational background and years of writing experience have given him a broad base for various content formats. Also, he’s a great cook, always ready to explore food, cultures, and adventures.

DETAILED INDUSTRY GUIDES
https://www.openxcell.com/software-development/

Software Development - Step by step guide for 2024 and
beyond | OpenXcell

Learn everything about Software Development, its types, methodologies, process outsourcing with our complete guide to software development.

https://www.openxcell.com/headless-cms/

Headless CMS - The complete guide for 2024 | OpenXcell

Learn everything about Headless CMS along with CMS, its types, pros & cons as well as use cases, and real-life examples in a complete guide.

https://www.openxcell.com/mobile-app-development/

Mobile App Development - Step by step guide for 2024 and beyond | OpenXcell

Building your perfect app requires planning and effort. This guide is a compilation of best mobile app development resources across the web.

https://www.openxcell.com/devops/

DevOps - A complete roadmap for software transformation | OpenXcell

What is DevOps? A combination of cultural philosophy, practices, and tools that integrate and automate between software development and the IT operations team.

GET QUOTE

MORE WRITE-UPS

Do you know about the shift happening in the Ecommerce industry?  Businesses are bidding goodbye to traditional platforms and adopting headless Ecommerce platforms. Don’t believe our words? Then consider these…

Read more...
11 Contemporary Headless Ecommerce Platforms One Must Know – 2024

In the past decade, blockchain and crypto experts have experienced a profound transformation due to the popularity of cryptocurrencies. It is projected that the global crypto wallet market will grow…

Read more...
How to Create a Crypto Wallet?: A Step-by-Step Guide

Looking for a healthcare professional? Try Teladoc. Need help tracking your daily medicine dose manually? Well, Medisafe is the answer for you. Want to take better care of your physical…

Read more...
13 Healthcare Apps Making Medical Care & Wellness Future-Ready