Thursday, February 2, 2012

File Size Matters

People love apps. Especially when they are simple and fast to get what they want done. There's a lot of work that goes into making an app's user experience as seamless as possible. Things ranging from subtle cues to picking sizes of buttons for Mr. Fat Fingers but one topic doesn't seem to get talked about, the file size.

While most users could care less how large an app is, after all they can fit 50,000 songs on their phone. What they care about is how long they have to wait to start using it. It is a critical part of the digital unboxing experience. And you know, everyone loves unboxing videos.

Many apps are downloaded on an impulse. Impulses tend to be short lived. Which means you probably only have seconds to gain the user's attention. The impulse starts before they hit the download button. Which means the time it takes to download the app takes away from the short time someone will be initially interested in your app.

Having bloated apps also have technical disadvantages too. If it's bad enough and you go over the 20MB limit you force users to download over WiFi which is an obstacle. Having resource downloads after the app is installed is preferred but is only acceptable for games.

Fortunately for Android does a lot of work during the compile process to keep package sizes small. There still some steps you can do to make sure that the package size is as small as possible:
  1. Make sure to obfuscate your app with ProGuard. ProGuard removes unused code, makes it faster, and more secure. The SDK now automatically turns this on. Learn the basics of the proguard.cfg file and use it to tighten your code.
  2. Use the Android Lint tool to find resources that are not used.
  3. Use XML shape drawables rather than bitmaps for simple shapes. These also scale very well.
  4. Don't use custom picture backgrounds, most of the time they cause overdraw problems and look ugly anyways.
  5. Use PNGs and use small set of colors for your images. Your app will look cleaner and leaner. Also, the aapt tool can optimize PNGs to 8-bit with palette when possible.
  6. When creating 9-patch drawables, don't apply padding in the png itself. Create a drawable that references the 9-patch and add the padding there.
Of course having a small package size isn't the only thing that's important but it is one of the first things that is, when it comes to the start-to-finish user experience.

No comments:

Post a Comment