LearningBasics
LearningBasics

Reputation: 678

Reduce Android Application Size

I have developed HelloWorld Android Application which just prints Hello World using eclipse and from tutorial https://developer.android.com/training/basics/firstapp/index.html?hl=it,but to my surprise the app takes 2.21 MB of memory. Can you please suggest way to reduce this size to few kb's as this should not take much space, as I haven't added any images or code in it.

Upvotes: 4

Views: 738

Answers (3)

Logan Pickup
Logan Pickup

Reputation: 2374

Are you sure you are talking about runtime memory? Even a simple "Hello world" application with no icon from the default Android project has a 10MB heap with 9MB allocated on my phone. Its installed size is listed as 1MB.

I do not know how to reduce memory usage in such a simple app but I can give you some tips to reduce installed size; however, there is a limit to how small you can go.

If you have an icon for all screen resolutions from mdpi to xxhdpi, it will cost you 44KB. I have found the practical lower limit for a usable app to be a little above that; I have a reasonably small app that is only 95KB. However, this is expanded during installation; expect your app to take up to twice the APK's size once installed.

A good way to get rid of space for a small app is to remove the support library. It is included by default in new projects, and takes from 400-600KB. However, removing it comes at a cost - many user interface improvements such as fragments are only supported on older platforms using the support library, so you will either have to restrict the tools you are able to use or your target user base.

Upvotes: 2

Samvid Kulkarni
Samvid Kulkarni

Reputation: 129

Only way i found to reduce runtime memory is to use various optimization techniques. Here is the tutorial Android Dveloper. This tutorial will help you in increasing performance of your application as well as reducing the runtime memory consumption of your application.

Upvotes: 0

Shai Levy
Shai Levy

Reputation: 715

An APK is a zip file, you can open it and figure out what's taking the space. If that doesn't hint you enough come back and add this info.

Also, take a look a look at proguard Edit: Oh wait, I might have misunderstood you, did you mean storage space or runtime memory ? (RAM)

Upvotes: 4

Related Questions