有疑问可回帖
今天内容
崩溃检测
性能分析
adb shell dumpsys procstats --hours 3
adb shell dumpsys meminfo package_name|pid [-d]
adb shell dumpsys batterystats --charged package-name
adb shell dumpsys netstats detail
adb shell dumpsys gfxinfo package-name
Method Profile
使用ddms分析调用耗时。
monitor工具需要低版本的JDK8,可以使用这个版本
http://download.oracle.com/otn/java/jdk/8u51-b16/jdk-8u51-macosx-x64.dmg?AuthParam=1525588656_1cd0799fdeffac3e987e4f8faa4e1556
- 使用monitor的dump heap hprof文件
- 把生成的hprof文件保存
- 转成java支持的格式
- 借助于visualvm进行分析,了解内存分配情况
其实命令行也可以做到
am profile start [--user <USER_ID> current] [--sampling INTERVAL] <PROCESS> <FILE>
am profile stop [--user <USER_ID> current] [<PROCESS>]
am dumpheap [--user <USER_ID> current] [-n] <PROCESS> <FILE>
hprof-conv com.xueqiu.android_0506.hprof com.xueqiu.android_0506_java.hprof
耗电量分析
https://github.com/google/battery-historian
git clone https://github.com/google/battery-historian.git
cd battery-historian
go get -d -u github.com/google/battery-historian/...
go run setup.go
go run cmd/battery-historian/battery-historian.go
#清理耗电量数据
adb shell dumpsys batterystats --reset
adb shell dumpsys batterystats --enable full-wake-history
#运行测试用例
appium uiautomator
#收集耗电量数据
#>=7.0
adb bugreport bugreport.zip
#<=6.0
adb bugreport > bugreport.txt