Tips to make your app smaller

Thoughts By 4 years ago

When users download apps, it’s always a pain having to wait for a super long download. Getting them in as quick as possible should be a high priority. When an app download size is too big, I often find myself locking the phone and sometimes even forgetting to come back to it for a while. On the AppStore there’s even a threshold to prevent users download apps that are too big over 3G, currently at 50MB I believe.

There are a bunch of various ways to make your app a lot smaller:

Cut reusable images

I wrote a blog on this a while back. When reusing the same graphics over and over it may be better cutting them in such a way so only the differences need to be in images, such as logos, this will save some space, a lot in some cases. Also cutting 9 patch compatible images, which will reduce the amount of unnecessary pixels in an image.

Do graphics work in code

If the image is simple enough to render on the fly in code then do it. For one it will be extremely flexible for the future (such as when the retina displays came out), and two, it’s going to be a lot smaller in terms of filesize.

Compress your images

If you still use photoshop trying to find the best settings to make a small image, you aint seen nothing yet. ImageOptim is an amazing lossless tool that will use brute force to find the smallest possible size from a range of different compression tools out there. It works with PNG, GIF and JPG. Among compression, it will also remove all the unnecessary metadata information from the image. If you’re using Xcode, just remember to turn “Compress PNG files” off in your build settings, otherwise it will undo all your hard work (Xcode doesn’t compress them as well as this tool).

Strip your binary

I’m not sure how this applies to other languages, but in C (and subsets of,) there’s a bunch of debug information in your binary. Your app most likely doesn’t need this in production, so get rid of it. You can split your debug symbols off into a separate file so you can still get stack traces of crashes later on, you just need a crash log and your symbols file for that build.

In Xcode, build settings like this should serve you well:

  • Hemant Bosamia

    Nice post. Few more tips
    1) Use 8-bit images wherever possible, like grey scale are perfect example for this.
    2) In Adobe Photoshop choose ‘Save for web’, which can reduce size of JPEG and PNG images.
    3) If using audio files, compress such files.