Tuesday, 5 September 2017

A complete guide to minimising the size of Android and iOS apps

itproportal.com

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.


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 optimisation 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 realise 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 & 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 Optimisation
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 lesser 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 optimises 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 am 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 analysing 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 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.

No comments:

Post a Comment