shecodesthings
shecodesthings

Reputation: 1258

Restricting apk size - Even with large number of resources?

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

Upvotes: 1

Views: 756

Answers (1)

Raghunandan
Raghunandan

Reputation: 133560

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/

Upvotes: 2

Related Questions