Sunday, August 24, 2014

Why you should worry about the size of your Android app

No comments
My phone has 8GB of storage. Well, really 5.67GB once you account for the space the Android operating system takes up. Apps take up the vast majority of that space and I constantly find myself having to uninstall a game or two in order to have space on my phone to install the next game I want to play or app I want to use.

I find that being in this situation makes me pay much closer attention to the size of apps when browsing Google Play. If I'm going to install an app, it needs to provide enough value to be worth taking up space on my phone; the bigger the app, the more value it must provide to me.

Google, in fact, seems to agree with me. They've said on numerous occasions that smaller Android apps (also called "APKs") get installed more and uninstalled less. Consequently, making your app smaller could result in a boost in your Google Play search rankings, and increase your retention rate.




Remove third party libraries

Do you really need that third party library that gives you support for 100 different ViewPager indicator styles? Or could you get away with pulling out the one style you want to use and including it in your project directly? Reducing library dependencies is probably the biggest win you can get when trying to reduce app size.

But it might not be easy. It may take some time to pull out the pieces you need, and you may make a mistake or inadvertently introduce some new bugs. High cost & risk, high reward.

Proguard

Proguard shrinks your app size by removing any unused methods and classes. It also makes your app harder to reverse engineer by renaming your methods from something like void sendPasswordToServer(String password) to void a(String b). You can imagine how this also makes your app smaller.

If you're starting a new app, enable Proguard in your build right now. Seriously, go do it. Proguard is super easy to set up for a new app...the more code and libraries you add, the trickier it gets to add Proguard and be sure nothing will break. Five minutes of integration work now could save you major headaches later.

Shrink those images!

Image files take up much more space than text files, so ideally, you won't have many of them in your app. On the other hand, apps that include a lot of visual content are much more pleasant to use than staring at a wall of text. So what can you do?

Enter ImageOptim, a free program for Mac OS X that reduces the size of your images by removing unnecessary metadata and other tricky optimizations. (If you're on Windows, you could try PNGGauntlet, which I've heard works well, but I haven't used myself).

When I receive an image from one of our designers, I always run it through ImageOptim before adding it to an app (Android OR iOS). I frequently see size reductions of over 95%. If you haven't been doing this, try running all your images through the optimizer and you might be surprised at how much space you can save.



Overall, reducing app size helps you, as a developer, get your app installed by more users and it helps your users by being respectful of the limited amount of space they have on their mobile devices. It's really a win-win situation, so it's something that developers should constantly keep in mind.