I'm looking for a possibility to retrieve both, the package names and the common names of apps installed on an Android device via ADB – or at least to retrieve the common name if the package name is known. A quick search on our site brought up two related questions, but they don't solve my issue:
- How do I get the common name of an app having the package name (like com.android.blabla)? (command line or included app) doesn't work via ADB (but uses an app you've got to lookup with manually), matching the request of the OP
- How to find app based on package name? just reverts to an URL lookup at Google Play, which doesn't always fit (as not all apps are available there).
I'm looking for a way to retrieve the information directly from the device, if possible – not "any" way (including "web lookups" or "via an app") as those two questions have it.
I know there are multiple tools available to obtain package details:
adb dumpsys package
: While this lists all packages with a bunch of details, the "common name" is not shownadb shell pm list
: only gives the package namesaapt
would be able to obtain the common name, but would require to first pull the.apk
file from the device, which is not really convenient (and obviously will be pretty slow with many and/or large apps installed)
Did I miss something? I know the information must be on the device (how else could it show the app names in the GUI? I doubt Android parses the .apk
file each time the GUI need the "common name"). So is there a way to get hold of it, using ADB directly?
TL;DR
Background (if somebody's curious): I want to be able to quickly obtain a list of user-apps from any of my devices, without having to revert to acrobatics. A list of their package names I can retrieve using adb shell pm list -3
, but as those are package names only, recognizing apps is a guess-work. So if there were some ADB command to retrieve the common name for a given package name, I could simply use a loop like for pkg in $(adb shell pm list -3); do echo "- $(adb <whatever_the_command_is> $pkg) ($pkg)"; done
– and get a listing of all the installed user-apps in a "human readable format" together with their package names.
Use-cases:
- See what "superflous" apps are installed (which I could remove)
- Cross-check lists from multiple devices
- Documentation ;)
- and probably more (but the above 3 are what I need it for)
<APP_NAME> and <PKG_NAME>
from the databases (localappstate.db
) inside it. Have you tried it? I've not verified whether ADB backup covers Play Store or not. – Firelord Jul 07 '15 at 19:44adb install
) which the playstore doesn't know? And secondly, assuming a not-rooted device: would that database be accessible via ADB in some way? "From the databases inside it" surely means somewhere below/data/data
, which is not "openly accessible" without root. Need to check whether that database would be accessible from an ADB backup – which still would require having the SSL libs available to decrypt that. – Izzy Jul 07 '15 at 20:47<APP_NAME> and <PKG_NAME>
of all system+user apps. Talking about Play Store, its database is also covered by ADB backup, but it would give<APP_NAME>
only for those apps which are installed using Play Store. The rest are listed by<PKG_NAMES>
only. // It could help I guess. – Firelord Jul 07 '15 at 21:40aapt
is included with Android ROMs from 4.4 (Kitkat) onwards, see this answer. Can anyone confirm this for stock ROMs? – Izzy Jul 18 '15 at 14:37