1

I've used the following as my research :

http://developer.android.com/guide/practices/screens_support.html

Too large APK due to multiple densities and screens sizes?

How to reduce App (.apk) Size

I'm currently working on getting my application to support multiple screen sizes. At the moment I don't have the following in place:

  1. Separate layout files for different screen sizes
  2. Separate images in the relevant image-density folders (ldpi, mdpi, hdpi, xhdpi).

Other info:

  1. All images are .png
  2. I do want to support large screen sizes like tablets
  3. I do not wish to support anything below this size - 320x480

Even though I don't have everything in place yet, my app is highly customized(in terms of graphics) - and is now a little over 4 mb.(.apk size)

If I do add separate layout files, and images - the app .apk file size will probably explode.

Question:

How can I get around this and keep the .apk file size to a minimum?

Idea's I've come up with so far:

  1. Bitmap sampling - and creating an image loader
  2. Downloading images from the net - I wish to avoid doing this unless there's no other option.
  3. Converting some files to .jpeg files - Still a little unclear on how that works.
  4. Using .9.patch image files? I believe this makes layout design easier.. but not sure if I could use that to save on .apk size
Community
  • 1
  • 1
shecodesthings
  • 1,218
  • 2
  • 15
  • 33
  • Why are you aiming to keep the size to a minimum? What criteria are you using? "Will probably explode". If your images are that large, then you will likely have problems anyway. What size are they? (resolution and colour depth is important, not file size). – Simon Apr 17 '13 at 17:23
  • Hi Simon, Here's what I have: 1. Most of my image sizes are 72x72, .png,alpha,color 2. I have some background images which are 320 x 60 .png, color 3. I have one fairly large image which is 512x512 .png, alpha, color – shecodesthings Apr 17 '13 at 17:38
  • So your APK might increase by 1mb or something of that order. No big deal. – Simon Apr 17 '13 at 17:46
  • Well in the next few updates I will be adding some large images. I'm not quite sure how that will work out in my head quite yet, but basically I am adding an in-game map. I'm thinking of using a tile-like method. That's what's worrying me. – shecodesthings Apr 17 '13 at 17:59
  • I regularly use apps that are 30/40/50mb. – Simon Apr 17 '13 at 18:00
  • Well I have a competing app to deal with. I'm a rookie developer, however I still want to make sure my app isnt unnecessarily huge. I've managed to cut down on a lot of useless images by implementing shapes instead and I've decided to cut down on all the images I use in my tutorial activity, and just build the "how to" part without screen shots. – shecodesthings May 15 '13 at 18:43

1 Answers1

2

You can enable ProGuard in release mode. The ProGuard tool shrinks, optimizes, and obfuscates your code by removing unused code and renaming classes, fields, and methods with semantically obscure names. The result is a smaller sized .apk file that is more difficult to reverse engineer.

http://developer.android.com/tools/help/proguard.html.

Also have a look at the video in the link

http://www.youtube.com/watch?v=amZM8oZBgfk. The talk is about multiversioning.

Tips for reducing .apk file size

http://developer.sonymobile.com/2012/01/31/tips-for-reducing-apk-file-size/

Raghunandan
  • 132,755
  • 26
  • 225
  • 256