How to reduce App (.apk) Size

Viewed 67508

Help!

When I install my app on the phone to test, it is showing up to be a HUGE size, 11.35 MB. It is a very simple app that lets user browse through fun-facts. The only reason I can think of is that there are 14 JPEG files in the drawables which serve as background images of the fun-facts. The average size of these is about 500 KB.

I'd like to trim the size of my app, so as not to use up the precious resources on the user's device. Other than just getting rid of the pictures, are there ways to optimize the size of apk file?

EDIT: The pictures are photos taken by me using the Android phone itself.

23 Answers

Convert to WebP which will significantly reduce the app size

It reduced the app size of my app which was 40 mb to 25 mb

Steps:

  • Right click on res
  • convert to WebP

What it does: It reduces the size to png to WebP format. Quality is also not destroyed


enter image description here

I know i am late here to answer this question but i reduce my app size using below techniques so i want to share these things with all.

1)- Use WebP images instead of Jpeg images, it will provide huge impact on apk size if you are using multiple images.

2)-Use VectorDrawables if you are using simple small icons in your app.

3)- Use View's tint property in xml to avoid multiple same icons but Different in color.

search DrawableTint and TintableImageview

4)- Use 9-patch images and avoid duplication of image or anything in the app code.

Below are the links to refer to reduce APK size.

https://developer.android.com/topic/performance/reduce-apk-size.html

https://developer.android.com/studio/build/configure-apk-splits.html#configure-split

https://developer.android.com/training/multiple-apks/index.html

Along with the above most upvoted answers, I would like to answer with latest tools from Google's Android Studio.

Google recently has introduced the Android App Bundle in which playstore automatically delivered optimized version of apk to end devices. Now developers just has to generate Signed Bundle, and upload to play store, dev job is done. Don't forget always use SVG images.

Also please have look into Deliver Features On-Demand with Dynamic Features

enter image description here

Use MinifyEnable true and ShrinkResources true

MinifyEnabled will reduce your code as it compresses it. While shrinkResources shrink the resources.

To use ShrinkResources you have to set minifyEnbled true.

Related