adb

常用adb命令

Posted by JamesPxy on 2019-11-12

1.获取anr 文件

adb pull /data/anr/traces.txt

2.获取栈顶activity:

1
2
3
4
5
6
7
8
9
10
1.通过adb命令

adb shell dumpsys activity top
adb shell dumpsys activity | grep Resumed

adb shell dumpsys activity activities | grep "Run"

2.ActivityManager manager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);

3.通过 Android Studio 的 Profile 查看:

3.使用adb获得当前应用 activity堆栈信息

-获取所用应用

adb shell dumpsys activity

-获取自己的应用

adb shell dumpsys activity | grep com.xxx.xxx.xx

-获取处于栈顶的activity

adb shell dumpsys activity | grep mFocusedActivity

4.adb拦截log日志:

adb logcat | grep "com.kufeng.hj.enjoy"
adb shell  "logcat | grep "com.kufeng.hj.enjoy""


支付宝打赏 微信打赏

赞赏一下