Question

While going thorough device "/data/app" folder on my rooted Galaxy S2(4.3), i am able to see all application names either ends with -1.apk or -2.apk

Can someone explain this,Why So??, also for new apps installed from google play, names ends with -1.apk or -2.apk
screenshot is as below.

enter image description here

Was it helpful?

Solution

When you have one application installed say - googleplay. And if any updates of the same app comes afterwords, and if you update the app then Android will download the apk and renames it to apk-2.apk and replaces the currently installed (apk-1.apk) application with a newer one (apk-2.apk).
I don't know exactly why Android does that but that is the done with names of apk - apk-1.apk and apk-2.apk.

So It goes this way.
1. You have one application installed say - playmusic then the apk in the "/data/app/" will be playmusic-1.apk
2. One update came in playstore for playmusic. you selected - update. Updates start downloading.
3. After downloading the update "Android OS" will install playmusic and update your app. and if you now see the "/data/app" folder it will be playmusic-2.apk

As mentioned previously I don't know why Android OS does that but Its the mechanism.
Here by playmusic-1.apk and playmusic-2.apk means com.google.playmusic OR whatever the package name is.
You can also try this by yourself.
The answer of WHY Thanks to @Geobits the mystery is solved. Android does because two apk files with the same name can not exist in the same directory.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top