一、手机或模拟器上已安装app(美团为例)
- 方法一:在命令行输入adb shell am monitor,按Enter,再启动想要获取的app
(包名在最后一行:com.sankuai.meituan)
C:\Users\starteos>adb shell am monitor
Monitoring activity manager... available commands:
(q)uit: finish monitoring
** Activity starting: com.sankuai.meituan
- 方法二:先启动想要获取的app,再输入命令:adb shell dumpsys window w | findstr / | findstr name=,按Enter
(包名在倒数第二行)
C:\Users\starteos>adb shell dumpsys window w | findstr \/ | findstr name=
mSurface=Surface(name=GestureNavBottom)/@0x13b0c39
mSurface=Surface(name=GestureNavRight)/@0x1108b23
mSurface=Surface(name=GestureNavLeft)/@0x1108b89
mAnimationIsEntrance=true mSurface=Surface(name=StatusBar)/@0xcaf1d1
mSurface=Surface(name=PopupWindow:b18885b)/@0x11b9aa5
mSurface=Surface(name=com.sankuai.meituan/com.meituan.mmp.lib.mp.MPActivity0)/@0x1170be9
mAnimationIsEntrance=true mSurface=Surface(name=com.android.systemui.HwImageWallpaper)/@0x10b4741
- 方法三:先启动想要获取的app,再输入命令:adb shell dumpsys window | findstr mCurrentFocus,按Enter
(包名在中间)
C:\Users\starteos>adb shell dumpsys window | findstr mCurrentFocus
mCurrentFocus=Window{11b2959 u0 com.sankuai.meituan/com.meituan.mmp.lib.mp.MPActivity0}
- 方法四:获取手机第三方所有应用的包名,输入命令:adb shell pm list package -3,按Enter
(包名在最后一行,每台设备具体位置不同)
C:\Users\starteos>adb shell pm list package -3
package:io.appium.settings
package:com.smarttoolfactory.tutorial3_1transitions
package:com.sankuai.meituan
二、电脑上有apk安装包
- 输入命令:aapt dump badging + apk路径
C:\Users\starteos>aapt dump badging D:\meituan_ui\app\imeituan.apk
package: name='com.sankuai.meituan' versionCode='1200020206' versionName='12.2.206' platformBuildVersionName='12.2.206' compileSdkVersion='29' compileSdkVersionCodename='10'
- 输入命令:aapt dump xmltree + apk路径 + AndroidManifest.xml | findstr “package”
C:\Users\starteos>aapt dump xmltree D:\meituan_ui\app\imeituan.apk AndroidManifest.xml | findstr "package"
A: package="com.sankuai.meituan" (Raw: "com.sankuai.meituan")
文章来源地址https://www.toymoban.com/news/detail-509235.html
文章来源:https://www.toymoban.com/news/detail-509235.html
到了这里,关于adb获取app包名的方法的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!