1. Introduction
The full name of adb is Android Debug Bridge, which is a tool in Android SDK. Using adb, you can directly operate and manage Android emulator or real Andriod device, which is to play the role of debugging bridge.
2. Common commands
- Connect devices on the network
adb.exe connect IP地址:端口 (端口默认为:5555 可以省略)
- Disconnect devices from the network
adb.exe disconnect IP地址:端口 (端口默认为:5555 可以省略)
- View connected devices (USB connection can directly execute this command, and then click Authorize on the phone)
adb.exe devices -l
- Enter the command line, you can directly execute the shell command after entering, without adding adb shell in front of the command
adb.exe shell
- Query the installed system application package name (executed in adb shell)
pm list packages –s
- Query the installed third-party application package name (executed in adb shell)
pm list packages -3
- Query all application package names (executed in adb shell)
pm list packages
- Install the local apk
adb install 安装文件名
- Uninstall the app (executed in adb shell)
pm uninstall --user 0 包名
- Transfer computer files to mobile terminal
adb push 电脑端路径 移动端路径
- Transfer files from mobile to computer
adb pull 移动端路径 电脑端路径
- Check the CPU status of the mobile phone (executed in the adb shell)
dumpsys cpuinfo
- Display disk usage information (executed in adb shell)
dumpsys diskstats
- Disable app (executed in adb shell)
pm disable-user 包名
- Enable application (execute in adb shell)
pm enable 包名
- Get phone battery status information (executed in adb shell)
dumpsys battery
- Disable installation of software via APK files (executed in adb shell)
pm disable-user com.android.packageinstaller
- Allows installation of software via APK files (executed in adb shell)
pm enable com.android.packageinstaller
- Reboot the device (execute in adb shell)
reboot