屏幕截屏
adb shell screencap
screencap [-hp] [-d display-id] [FILENAME]
-h: this message
-p: save the file as a png.
-d: specify the display id to capture, default 0.
- 截图保存到sdcard : adb shell screencap -p /sdcard/screen.png
- 将图片导出 adb pull /sdcard/screen.png
- 删除sdcard中的图片:adb shell rm /sdcard/screen.png
adb shell screencap -p /sdcard/screen.png && adb pull /sdcard/screen.png {你要保存的文件的loaction}\{你要保存的图片的名称}.png && adb shell rm /sdcard/screen.png
管理Activity
adb shell am
adb shell am start [options] <INTENT>
作用:启动一个activity
adb shell am startservice [options] <INTENT>
作用:启动一个service
adb shell am force-stop <PACKAGE>
作用:强制关闭一个应用程序
adb shell am broadcast [options] <INTENT>
作用:发送一个广播
[options]与<INTENT>具体参照:http://developer.android.com/tools/help/adb.html#am
例子
adb shell am start -n com.example.wegame/com.example.wegame.MainActivity
Camera(照相机)的启动方法为:
adb shell am start -n com.android.camera/com.android.camera.Camera
Browser(浏览器)的启动方法为:
adb shell am start -n com.android.browser/com.android.browser.BrowserActivity
启动浏览器 :
adb shell am start -a android.intent.action.VIEW -d http://www.google.cn/
拨打电话 :
adb shell am start -a android.intent.action.CALL -d tel:10086
查看手机应用程序信息
adb shell dumpsys
adb shell dumpsys activity 显示activity相关的信息,这个是最常用的,可以分析当前栈上的内存信息
adb shell dumpsys statusbar 显示状态栏相关的信息
adb shell dumpsys meminfo $package_name or $pid 使用程序的包名或者进程id显示内存信息
例子
adb shell dumpsys activity activities