adb shell 方式获取
通过cmd adb命令,执行前需要把想要获取appPackage和appActivity的App运行
(之后通adb 连接手机或模拟器)
0、adb connect 127.0.0.1:7555 #先连接手机或模拟器,这里是模拟器
1. adb shell
2. dumpsys activity | grep mFocusedActivity
+执行结果如下+++++++++++++++++++++++++++++++++++++++++++++++++
D:\leam\>adb shell
root@DUK-AL20:/ # dumpsys activity | grep mFocusedActivity
dumpsys activity | grep mFocusedActivity
mFocusedActivity: ActivityRecord{f35c466 u0 com.ss.android.ugc.trill/com.ss.an
droid.ugc.aweme.splash.SplashActivity t289}
root@DUK-AL20:/ #
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#蓝色为appPackage
#绿色为appActivity