一、手机或模拟器上已安装app(美团为例)
- 方法一:在命令行输入adb shell am monitor,按Enter,再启动想要获取的app
(包名在最后一行:com.sankuai.meituan)
C:\Users\starteos>adb shell am monitorMonitoring 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 -3package:io.appium.settingspackage:com.smarttoolfactory.tutorial3_1transitionspackage:com.sankuai.meituan
二、电脑上有apk安装包
- 输入命令:aapt dump badging + apk路径
C:\Users\starteos>aapt dump badging D:\meituan_ui\app\imeituan.apkpackage: 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://blog.csdn.net/kldzh/article/details/127567585
免责声明:
① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。
② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341