(转载)测试工具monkey

转自http://www.418log.org/post-32.html

1)进入shell

 在桌面点开始--运行 输入cmd 点确定 或打开 cmd.exe 进入sdk tools目录如:

1 C:\Users\Administrator>d:
2 C:\Users\Administrator>cd D:\Program Files\android-sdk\platform-tools>

 查看本机已经启动的模拟器

1 D:\Program Files\android-sdk\platform-tools>adb devices
2 List of devices attached
3 emulator-5554   device

 进入shell命令行

 adb shell

 后显示为#  如果显示为$   输入su

 exit 退出

 在 adb shell 命令前运行 adb remount

(2)进入shell后

 ls

 cd data

 下面还有个data,进入后下面是程序的包

 可以直接输入monkey -p com.jd.customer -v 50,后会自动切换界面

 也可以退出shell,在命令行输入,

 adb shell  monkey -p com.jd.customer -v 50 --hprof 生成报告

 .hprof 文件会自动保存在SD卡上,然后把.hprof 文件拷贝到PC上的

  \ android-sdk-windows\tools目录下。

  这个由DDMS生成的文件不能直接在MAT打开,需要转换。运行cmd打开命令行,

  cd到\ android-sdk-windows\tools所在目录,并输入命令

  hprof-conv xxxxx.hprof yyyyy.hprof,其中xxxxx.hprof为原始文件,

  yyyyy.hprof为转换过后的文件。

  转换过后的文件自动放在android-sdk-windows\tools 目录下。

  OK,到此为止,.hprof文件处理完毕,可以用来分析内存泄露情况了。

posted @ 2013-12-23 22:48  西北野狼  阅读(269)  评论(0编辑  收藏  举报