Android - See where app size comes from

70 views Asked by At

My app is a fine size when it is first downloaded, but I rapidly gain around 10-12 megs after authorizing some sites using OAuth and using the app a little bit. I want to see where all this extra data is coming from, since I am sure only around 2 meg per site is used by authorizing using OAuth.

I am not sure if somehow I am saving too many oauth credentials, or am saving too many things to sharedpreferences ...

Is there any way I can analyse the data of a downloaded version of my app to see where this data comes from?

2

There are 2 answers

1
Bryan Herbst On BEST ANSWER

The size of your app itself on the device will not change.

What can change is the size of the data that the app is storing on your device. Most private app data is stored in /data/data/<com.example.yourapp>. I would start by looking there for large files.

Some things to watch out for would be cached files that your app no longer needs, or SQLite databases that grow after going through your OAuth flow. It is also possible that simply adding a SQLite database at all would explain the difference, depending on what the starting size of your app is.

1
Jalapeno On

One tip to either reduce your total memory allocation or make the app run as smooth as possible even when you use a lot of memory is to regularly call the function System.gc();

I know it's not a method of monitoring where your memory comes from but if you call it every time your app closes a website or navigates to a new one, or at a regular interval which you decide, it will clear up memory that is not being used and make the overall experience smoother.