问题描述
我正在开发一个使用 ADB Shell 与 android 设备交互的应用程序,我需要某种方式打印出应用程序名称或应用程序的标签,可能是它们的包名称.
I'm developing an application that uses ADB Shell to interface with android devices, and I need some way of printing out the application name or label of an application, given maybe their package name.
简而言之,我需要一种通过 adb shell
为用户安装的应用程序获取应用程序名称(即Angry Birds v1.0.0")的方法.
In short, I need a way of getting app names (i.e. "Angry Birds v1.0.0") for user installed applications through adb shell
.
对此事有任何启示吗?对此的任何帮助表示赞赏.
Any light on the matter? Any help is appreciated on this.
推荐答案
adb shell pm list packages
将为您提供所有已安装包名称的列表.
adb shell pm list packages
will give you a list of all installed package names.
然后您可以使用 dumpsys |grep -A18 "Package [my.package]"
获取版本标识等包信息
You can then use dumpsys | grep -A18 "Package [my.package]"
to grab the package information such as version identifiers etc
这篇关于通过 ADB Shell 或终端获取应用程序名称/标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!