adb 常用命令详解
1、把电脑上文件或目录copy到手机中:adb push <local> <remote> - copy file/dir to device
此处的<local>就是指电脑,<remote>就是指手机或者模拟器。此处需要注意的是,电脑上的路径是“C:\”,手机上的是“/sdcard/”,两处的斜杠方向不同。
2、把手机文件copy到电脑上:adb pull <remote> [<local>] - copy file/dir from device
3、安装apk:adb install [-l] [-r] [-s] [--algo <algorithm name> --key <hex-encoded key> --iv <hex-encoded iv>] <file>
('-r' means reinstall the app, keeping its data) 强制安装(在某些情况下可以已有些应用程序在运行或不可写,可加上此参数强制安装)
('-s' means install on SD card instead of internal storage) 安装到SD卡,非手机内存
4、卸载apk:adb uninstall [-k] <package> - remove this app package from the device
('-k' means keep the data and cache directories) 卸载时保留配置和缓存文件
5、查看手机系统的具体命令:adb shell
adb shell getprop:查看机器的全部信息参数(硬件信息到所刷的ROM版本信息)。
adb shell getprop ro.serialno:查看机器的SN号
adb shell setprop persist.service.thermal 0 修改信息参数
6、等待设备接入: adb wait-for-device - block until device is online
7、可以与其他命令连用:adb wait-for-device install <app>.apk
8、启动adb服务进程: adb start-server - ensure that there is a server running
9、关闭adb服务进程: adb kill-server - kill the server if it is running
10、获取设备的当前状态: adb get-state - prints: offline | bootloader | device
11、获取SN number: adb get-serialno - prints: <serial-number>
12、重新挂载系统分区,使系统分区重新可写: adb remount
- remounts the /system partition on the device read-write
13、重启设备:adb reboot [bootloader|recovery] - reboots the device, optionally into the bootloader or recovery program 直接重启设备回到使用界面
adb reboot-bootloader - reboots the device into the bootloader 重启设备到bootloader引导模式
adb reboot recovery 重启到recovery刷机模式
14、获取管理员权限: adb root - restarts the adbd daemon with root permissions
15、至于adb shell am/pm的命令,请参考http://www.cnblogs.com/zh-ya-jing/p/4702411.html