about ADB:adb, that is, Android Debug Bridge. Interoperate with Android with this tool
adb command format:
adb [-d|-e|-s <serialnumber>] <command>
The brackets are not required. Example: Adb-s emulator-5554 install xxxxxx.apk follow XXXX application-D: Perform a unique connection to the real Android phone on the PC to perform the naming. This parameter does not allow the PC side to connect multiple devices- E: Similar to-D, perform a name on the simulated Android phone that is only attached to the PC. This parameter does not allow the PC side to connect multiple devices-S: Command execution via device serial number designation device
Common commands:
view adb versions: ADB version is also commonly used as a validation of ADB installation success
View connected devices and emulators: ADB devices
Install software: adb install xxx.apk xxx To specify the APK path to installCommon parameters:-S installed on the SDK, for example: Adb-s install xxx.apk-R Preserve data and cache files, reinstall APK
Uninstall: adb uninstall xxx.apk Direct Uninstalladb-k Uninstall xxx.apk Uninstall but retain user's data
copy files: Copy from PC to phone: adb push [PC-side file location] [store to phone path]from phone to PC: ADB push [location of files stored on the phone] [path of file to PC side]
List all package names for the system: ADB shell PM List PackagesList all registrations for the system: ADB shell pm List packages-sList the third-party application package name except for the system's own program: ADB shell pm List packages-3
pipe character command: | grep and Linux are basically consistent in usage
clear the application's cache and data: adb shell pm Clear [package name]
View log: adb logcat
View Android system version: adb shell Getprop ro.build.version.release
Viewing screen resolution: ADB shell WM size
start adb server:adb start-serverstop adb server:adb kill-server
Restart : adb reboot
Check if the device has root:adb shellsu$ means no root, #为已经root
View Resource usage: adb shell top
input of analog keys:format: adb shell input keyevent [keycode]adb Shell Input KeyEvent 3 Press the home keyadb Shell Input KeyEvent 4 Press the back keykeycode with the corresponding keys:
KeyCode |
Keys |
3 |
HOME |
4 |
Return |
5 |
Turn on dialing |
6 |
Hang up the phone |
24 |
Increase volume |
25 |
Lower Volume |
26 |
Power key |
27 |
Photo |
64 |
Open your browser |
82 |
Menu key |
85 |
Play / Pause |
86 |
Stop playing |
87 |
Play the next song |
88 |
Play the previous song |
126 |
Resume Playback |
127 |
Pause Playback |
164 |
Mute |
176 |
Open System settings |
207 |
Open a contact |
208 |
Open calendar |
209 |
Open music |
210 |
Open Calculator |
220 |
Reduce screen brightness |
221 |
Improve screen brightness |
223 |
System hibernation |
224 |
Light the screen. |
ADB Common operations commands