How to make Android and iOS apps smaller

iphone-home-screen

In an ideal world, if you were the sole provider of any service through app and the users had unlimited resources on their devices, there would be no question of optimization and terms like agility and even user experience would be redundant. But as you might know, the current state of app industry is anything but ideal. There are dozens of apps competing for even the simplest of services and no matter how premium device a user has, there is always a limit to the number of apps it can operate smoothly.

The worst part, however, is scenario where after spending considerable amount of time, money and resources into developing and marketing an app, the users perceive it to be bulky and either never install it or uninstall after they find the memory it consumes is disproportionate to the value it brings.

And be it iOS app development or Android app development services, this is one problem where both stand on the same page. For that reason, it is no coincidence that two of the most popular apps, Facebook and YouTube, also offer a lite version of their app beside the regular one. If you are in iOS or Android app development business, you would realize that the problem isn’t just about those hesitant users, but keeping up the performance and even maintenance of large apps is exponentially tougher than small ones. So, let’s take a look at some of the tools and techniques using which the size of these apps can be reduced.

For iOS app development

App thinning tools. Apple offers a host of tools at both levels- store and OS, to help an app minimise its size, leverage device features and accommodate to future updates. The two most useful of such tools are:

Slicing. It enables the developers to upload a single full version of their app to the store, which then is converted into different variants and is distributed accordingly to the device.

On-demand resources. Instead of packing everything in the initial app, it is much better to simply offer a basic version upon which the users can get only those content that they actually want. For example, if you have an app for magazine, instead of giving them the full version, offer them the option to download each section separately.

Media optimization. Though media like image, audio, videos, etc are what drive user engagement, they are also responsible for shooting up the size of any app. Simple tasks like using proper resolution and formatting can help developers cut-short the size without compromising on the content quality. For instance, developers can choose to use PNG formats for displaying images, which not only consumes less memory, but also generates quality on par with more popular formats like JPEG.

Memory allocation manager. Unlike garbage collection in Java, iOS development never had a efficient memory management technique. Even with Automatic Reference Counting (ARC) that it does have, there are certain issues and lapses that keep happening over time. From simple issues like over caching to more complex ones like retain cycles, there are a host of problems that if paid proper attention, can not only resolve a lot of bugs, but also free up a lot of memory.

Scanning IPA Files. Ipa files are the ones that stores the iOS app along with the binaries of ARM architecture upon which the operating system is based. These data in these files are continuously updated and when they get old enough, there can be plenty of irreverent data and outdated items which you easily delete after scanning.

For Android app development

Resource shrinking tools. Resource shrinking can be availed from the Android plugin for Gradle, which removes unused resources from the packaged app, including those in the code libraries. Also, since it works in conjunction with code shrinking tools, the moment you eliminate some part of code, the resources corresponding to it are also eliminated.

Image compressor. As discussed for iOS, images are a crucial part of Android apps as well and since majority of the content in modern apps are image based, compressing them to consume less memory is perhaps the simplest of step you can take to reduce the app size. Also, reducing the size of images will also make them load faster, thus contributing to better user experience.

Code shrinking tools. Code shrinking is available with ProGuard, which detects and removes unused classes, fields, methods, and attributes from the packaged app, including those from included code libraries. It also optimizes the bytecode, removes unused code instructions, and obfuscates the remaining classes, fields, and methods with short names, that is known to drastically reduce the size of the .apk file and even aid in its security by some degree.

Architecture reduction. Creating an elegant app is no less than a work of art. While two mobile applications may perform similar tasks, the underlying architecture is what actually determines the size and consequently their performance. A clean architecture is one where different layers of the software align similar to that in an onion, with progressive dependencies pointing inwards. When compared to common architectures where the dependencies and connections between different components appear more like a mesh, this model drastically reduces the size and makes further improvements a breeze.

For both

Static code analyser. There are a number of static code analyzing tools available for both iOS and Android development which when deployed can quickly detect any unused functions, variable, logic flaws, etc., and thus reduce the overall size.

Code recycling. Creating an app is not a one-time feat but more like a continuous process. If you wish you app to preserve its compact size and performance, you should consider recycling the code every chance you get. Also, every time you update an app, there are bound to be some sections of code that lose relevance, which you must promptly remove to keep the size from escalating.

Final thoughts

While there are no debates over the efficiency and higher adoption of apps with smaller size, the procedures to achieve that goal requires sophisticated tools and expertise that only those companies with ample experience in both iOS app development and Android app development can bring.

Mrityunjay Kumar, content developer, Konstant Infosolutions.

Published under license from ITProPortal.com, a Future plc Publication. All rights reserved.

Image credit: Ellica / Shutterstock

One Response to How to make Android and iOS apps smaller

© 1998-2024 BetaNews, Inc. All Rights Reserved. Privacy Policy - Cookie Policy.