ADB full name Android Debug Bridge, is a tool in the Android SDK, with this tool can directly operate the management of Android simulator or real andriod device (mobile phone), so in fact, work can give us a lot of help, The following is a summary of the ADB commands commonly used in previous work:
- ADB help, listing all option descriptions and subcommands
- ADB devices, get device list and device status
- ADB get-state, gets the status of the device, the state of the device has 3 minutes,,,
device
offline
unknown,其中device:设备正常连接,offline:连接出现异常,设备无响应,unknown:没有连接设备
- ADB kill-server, adb start-server, end adb service, start adb service, usually two commands together, device state is abnormal when using kill-server, then run Start-server to restart service
- ADB logcat, print Android system log adb logcat-c, clear log
- ADB bugreport, print Dumpsys, dumpstate, logcat output, is also used for parsing errors, output is more, it is recommended to redirect to a file, such as adb bugreport > D:\bugreport.log
- ADB install, installation application, adb install-r Reinstall
- ADB Uninstall, uninstall the application, followed by the parameter is
应用的包名
, please distinguish fromapk 文件名
- ADB pull, copy files or folders on Android device to local, such as copy pull.txt file under SDcard to D Drive: adb pull sdcard/pull.txt d:\, rename: adb pulling Sdcard/pu Ll.txt D:\rename.txt
- ADB push, push local files to Android device, such as push D Drive under Push.txt to SDCARD:ADB push d:\push.txt Sdcard/sdcard trailing slash can not be less
- ADB reboot, restart Android device, adb reboot recovery, restart to recovery interface adb reboot bootloader, reboot to Bootloader interface
- ADB root, adb remount, can directly have these two commands to get root permissions, and mount the system file system as read-write status
- ADB Get-serialno, returns the device serial number SN value adb get-product, gets the ID of the device
- ADB forward tcp:5555 tcp:8000, as a request port for the host to the emulator or device
- ADB shell, enter the device shell
- ADB shell PM List package, listing all of the app's pack names
- ADB shell screencap-p/sdcard/screen.png, screenshot, save to SDcard directory
- ADB shell Screenrecord Sdcard/record.mp4, Operation phone after command, CTRL + C end recording, record results saved to SDcard
- ADB shell wm size, get device resolution
- ADB shell PM Dump package name, listing dump information for the specified application
- ADB shell PM Path package name, listing the. apk location for the corresponding package name
- The ADB shell monkey–p package –v test times, such as "adb shell monkey–p com.htc.weather–v 20000" means that for Com.htc.Weather this package is performed independently 20,000 times mon Key test, where the package name can be obtained at the command line terminal: LS data/data show All packages
- ADB Shell PS | grep [process], find the corresponding process PID adb shell Dumpsys Meminfo [PID], depending on the process PID view the memory occupied by the process or adb shell Dumpsys meminfo<package_na Me>,package_name can also be converted to program Pid,pid via adb shell top | grep app_name to find
- ADB shell PS to view process information in the current terminal
Note:
The port number used by ADB, it 5037
is necessary to remember
Some of the Linux commands used under the ADB shell command
Command:
LS//view directory
Date//Print or set current system time
Cat/proc/meminfo//View memory information
Cat/proc/cpuinfo//View CPU Information
App testing often uses ADB commands