List apps and their versions #21

Closed
opened 2024-11-11 16:13:49 +01:00 by Benjamin_Loison · 6 comments
adb shell cmd package list packages -3

Source: 53634311

works fine for listing apps but how to also list their versions?

```bash adb shell cmd package list packages -3 ``` Source: [53634311](https://stackoverflow.com/a/53634311) works fine for listing apps but how to also list their versions?
Author
Owner
adb shell cmd package -h
Output:
  list packages [-f] [-d] [-e] [-s] [-3] [-i] [-l] [-u] [-U]
      [--show-versioncode] [--apex-only] [--uid UID] [--user USER_ID] [FILTER]
    Prints all packages; optionally only those whose name contains
    the text in FILTER.  Options are:
      -f: see their associated file
      -a: all known packages (but excluding APEXes) 
      -d: filter to only show disabled packages
      -e: filter to only show enabled packages
      -s: filter to only show system packages
      -3: filter to only show third party packages 
      -i: see the installer for the packages
      -l: ignored (used for compatibility with older releases)
      -U: also show the package UID
      -u: also include uninstalled packages
      --show-versioncode: also show the version code
      --apex-only: only show APEX packages
      --uid UID: filter to only show packages with the given UID
      --user USER_ID: only list packages belonging to the given user
```bash adb shell cmd package -h ``` <details> <summary>Output:</summary> ``` list packages [-f] [-d] [-e] [-s] [-3] [-i] [-l] [-u] [-U] [--show-versioncode] [--apex-only] [--uid UID] [--user USER_ID] [FILTER] Prints all packages; optionally only those whose name contains the text in FILTER. Options are: -f: see their associated file -a: all known packages (but excluding APEXes) -d: filter to only show disabled packages -e: filter to only show enabled packages -s: filter to only show system packages -3: filter to only show third party packages -i: see the installer for the packages -l: ignored (used for compatibility with older releases) -U: also show the package UID -u: also include uninstalled packages --show-versioncode: also show the version code --apex-only: only show APEX packages --uid UID: filter to only show packages with the given UID --user USER_ID: only list packages belonging to the given user ``` </details>
Author
Owner
adb shell cmd package list packages -3 --show-versioncode
Output:
...
package:org.mozilla.fennec_fdroid versionCode:1320020
...

I doubt the versionCode to change from a commit to the other while the following change from a commit to the other as far as I know.

```bash adb shell cmd package list packages -3 --show-versioncode ``` <details> <summary>Output:</summary> ``` ... package:org.mozilla.fennec_fdroid versionCode:1320020 ... ``` </details> I doubt the `versionCode` to change from a commit to the other while the following change from a commit to the other as far as I know.
Author
Owner

image

![image](/attachments/99870d90-523f-43a8-a9f5-ac6df10fcc6d)
151 KiB
Author
Owner
adb shell dumpsys package com.termux | grep -E '^ *versionName='
    versionName=0.118.1
```bash adb shell dumpsys package com.termux | grep -E '^ *versionName=' ``` ``` versionName=0.118.1 ```
Author
Owner
Bash script listing versions of packages:
for package in `adb shell cmd package list packages -3 | cut -d ':' -f 2 | grep -E '^com.termux'`
do
    echo -n "$package: "
    adb shell dumpsys package $package | grep -E '^ *versionName=' | cut -d '=' -f 2
done
<details> <summary>Bash script listing versions of packages:</summary> ```bash for package in `adb shell cmd package list packages -3 | cut -d ':' -f 2 | grep -E '^com.termux'` do echo -n "$package: " adb shell dumpsys package $package | grep -E '^ *versionName=' | cut -d '=' -f 2 done ``` </details>
Author
Owner
It helps [Benjamin-Loison/android_packages_apps_Messaging/issues/10](https://github.com/Benjamin-Loison/android_packages_apps_Messaging/issues/10).
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: Benjamin_Loison/adb#21
No description provided.