获取包名和活动名

1. 方法一: pm list package查看包名

adb shell pm list package -f

adb shell pm list package -3 -f #获取第三方apk的包

2. 方法二:dumpsys window

adb shell dumpsys window w | findstr / | findstr name=

adb shell dumpsys window |findstr mCurrent

adb shell "dumpsys window w|grep /|grep name=|sed 's/mSurface=Surface(name=//g'|sed 's/)//g'|sed 's/ //g'"

3. 方法三:logcat日志抓取LAUNCHER

adb shell logcat | grep android.intent.category.LAUNCHER "

adb logcat ActivityManager:I *:s

4. 方法四:dumpsys activity

adb shell dumpsys activity | grep mFocusedActivity

5. 方法五:logcat日志抓START

C:UsersAdministrator>adb shell
root:/ # logcat | grep START

6. 方法六:aapt工具

使用aapt工具 ,适合给程序自动获取 apk 的相关信息,非常实用,
//aapt是sdk自带的一个工具,在sdkuilds-tools目录下
1.以微信为例,命令行中切换到aapt.exe目录执行输入以下命令

aapt dump badging D:XXX.apk
 
原文地址:https://www.cnblogs.com/huoyunxieshen/p/12930339.html