5

I am using android 4.4.2 on my Asus Zenfone 5 (not rooted). It seems that when I am updating any app from play store, it is installing a newer version without removing the older version.

Before updating total space occupied by all apps was around 400MB, after updating all the apps successfully the occupied space for apps increased to 1.1GB. As my internal memory is limited, I am little worried.

Is this behaviour normal? Can I get rid of old versions of those apps? What is the way to avoid such situation in future?

Additional question after reading the answer

  • Can the default apps be removed?
  • What if one tries to install the same app after removing the default app in /data?
sourav c.
  • 153
  • 1
  • 8

1 Answers1

4

From your description, it sounds like the problem might be due to built-in apps. Built-in apps (that come with the phone) don't take up your storage space, because they don't live in the data partition (where your apps and data are stored), but in the system partition. However, they can't be updated in the system partition, because it's read-only. Updating a built-in app is done by installing the new version to the data partition and ignoring the old version. The effect of this is that the whole size of the app occupies the data partition. Subsequent updates don't keep taking up more space: once the app is on the data partition, the package is simply replaced with newer versions in the usual way.

For instance, say the YouTube app is 17 MB. When it comes with the phone, it occupies no space on the data partition. It takes 17 MB in the system partition, but since you can't use that partition for anything else, that doesn't matter. Now you update YouTube from Google Play. The new version takes 17 MB on the data partition, as if it weren't a built-in app at all. The old version is still on the system partition, inactive, but it still makes no difference.

If you were to update a lot of built-in apps at once, then the effect would be much bigger.

This only applies to the app itself (the APK file), not its data and cache, which are always stored on the data partition.

Other than in the case of system apps like this, two versions of the same app (identified by their package name) can't coexist on the same device. Installing a newer version always removes the older version.

On a rooted device, or if you install a custom ROM, you can make the system partition writeable and update built-in apps directly on the system partition, so they still won't take up space on the data partition. This is quite a risky business, though: it's easy to accidentally change files you shouldn't change, and lose all your data or make the phone unusable. There's a reason the system partition is normally read-only!

Dan Hulme
  • 35,000
  • 17
  • 90
  • 155
  • Hi Dan, how can it write the same app to /data if it's already in /system? Is this something the dev can deliberately do? In the youtube example won't I be installing com.google.android.youtube in both instances? How does it know which to 'enable'? – RossC Nov 05 '14 at 15:25
  • 1
    It's nothing to do with the app developer; it's just the way Android updates system apps. It all happens within Android's package manager. The old version is still effectively uninstalled, as with a normal upgrade; it's just that the APK file is still there. – Dan Hulme Nov 05 '14 at 15:29
  • As the last paragraph in the answer implies, the /system partition is usually mounted read-only – so "system apps" cannot be updated directly. Hence the updates are installed in "user-space". Think of it like with the PATH environment variable, with the "user space apps dir" being put in front of the "system space apps dir"; so whenever the app is found in user-space, the "other directory" is not searched anymore. – Izzy Nov 05 '14 at 15:36
  • Thanks very much, that actually answers a few things that have been confusing me about system apps. Much appreciated, both of you! – RossC Nov 05 '14 at 15:36
  • Thank you for nice explanation, To be sure, if at the time of next update apps installed in /data partition will be replaced with newer version? – sourav c. Nov 05 '14 at 15:53
  • @souravc Yes, future updates to the same app are done in the usual way. I've added this information to my answer. – Dan Hulme Nov 05 '14 at 16:04
  • @DanHulme I have added a question after your answer. Please help me out. thanks again. – sourav c. Nov 06 '14 at 05:15
  • @souravc This is turning into an extended discussion, which doesn't really work well with this site's Q&A format. It's probably best if you join us in [chat] if you want to learn more. – Dan Hulme Nov 06 '14 at 17:22
  • This explains very well why phones get slower with years - if you use your phone for more than 3 years, there's a high chance it will receive updates for many Android components and preinstalled software, taking up space in your data partition, and usually you cannot move preinstalled apps to SD card. So at one point you might be forced to replace your old phone just because there's not enough free space for smooth running. – JustAMartin Jun 24 '19 at 13:52