The number has no special meanings. It is used to distinguish old and new packages during installation. While installing an app, the Package Installer first finds an available 'packageid-number' pattern, with the number incrementing from 1, and creates the directory (APK file for Android 5.0 and under). Then it places the APK file in it and removes the old one. Therefore, most commonly the number only varies from 1 to 2 because only one instance of an installed app exists. Summing up the old app and the temporary name, there can only be 2 instances. If you have, by some other means like installing 2 of the same app using a parallel container, there can be up to 4 instances of the app, thus creating com.example-4
.
Here's my experiment on Android 5.1.1, using Root Explorer to install the app and Terminal Emulator to monitor directory content change.
Preparation: Use XInstaller (an Xposed module) to allow downgrade installing app (so that I can repeatedly install the same version of an app).
1. Tap the prepared APK file in Root Explorer to install it. In my case, it's Termux.
2. Repeatedly run
root@android:/data/app # ls -d com.termux-*
Output:
First: com.termux-1
After some time: com.termux-1 com.termux-2
After more time and finally: com.termux-2
3. Tap the APK to install it again and repeat Step 2.
Output:
First: com.termux-2
After some time: com.termux-1 com.termux-2
After more time and finally: com.termux-1
4. Create placeholder directories named com.termux-2
, com.termux-3
, com.termux-4
and set correct permissions.
5. Repeat Step 3.
Output:
First:
com.termux-1 com.termux-2 com.termux-3 com.termux-4
After some time:com.termux-1 com.termux-2 com.termux-3 com.termux-4 com.termux-5
After more time and finally:com.termux-2 com.termux-3 com.termux-4 com.termux-5
Where com.termux-2
, com.termux-3
, com.termux-4
are all empty as they are created by me, not the Package Installer. To verify, run
root@android:/data/app # pm list packages -f | grep com.termux
package:/data/app/com.termux-5/base.apk=com.termux