經過cmd adb命令,執行前須要把想要獲取appPackage和appActivity的App運行android
(以後通adb 鏈接手機或模擬器)shell
0、adb connect 127.0.0.1:7555 #先鏈接手機或模擬器,這裏是模擬器app
1. adb shellspa
2. dumpsys activity | grep mFocusedActivitycmd
+執行結果以下+++++++++++++++++++++++++++++++++++++++++++++++++it
D:\leam\>adb shellsed
root@DUK-AL20:/ # dumpsys activity | grep mFocusedActivitygrep
dumpsys activity | grep mFocusedActivity
mFocusedActivity: ActivityRecord{f35c466 u0 com.ss.android.ugc.trill/com.ss.an
droid.ugc.aweme.splash.SplashActivity t289}gc
root@DUK-AL20:/ #方法
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#藍色爲appPackage
#綠色爲appActivity