Android中使用adb命令获取当前打开app的包名

android开发中,我们可以使用adb命令来获取当前打开应用的包名,命令如下:

adb shell dumpsys window | findstr mCurrentFocus

1
手机连接上电脑,并且在手机上打开微信,然后再cmd命令行窗口运行以上命令:

D:\>adb shell dumpsys window | findstr mCurrentFocus
  mCurrentFocus=Window{1eb9031 u0 com.tencent.mm/com.tencent.mm.ui.LauncherUI}

在上面的输出结果中,com.tencent.mm是包名,com.tencent.mm.ui.LauncherUI是当前打开的activity类名

posted @ 2022-06-04 01:07  ZaleSwfit  阅读(2428)  评论(0编辑  收藏  举报