Introduction to adb and summary of common commands

Table of contents

I. Overview:

2. Commonly used basic commands:

Three, adb resource download

4. Installation and use

Five, adb detailed introduction


I. Overview:

adb (Android Debug Bridge), the Android platform debugging bridge, is a bridge connecting Android phones and PCs. Through adb, you can manage and operate emulators and devices, such as installing software, viewing device software and hardware parameters, system upgrades, and running shell commands. In some specific cases adb comes in handy, including the following parts:

The client side runs on the PC. It is used to send adb commands.
Deamon, the daemon process, runs in the debugging device, that is, the debugging phone or emulator.
The server side, runs as a background process in the development machine, that is, your development PC Machine. It is used to manage the communication between the Client in the PC and the Deamon in the mobile phone.

A brief summary of the main functions:
1. Run the shell (command line) of the device 
2. Manage the port mapping of the emulator or device 
3. Upload/download files between the computer and the device 
4. Install the local apk software to the emulator or android device

2. Commonly used basic commands:

1. Start adb: adb start-server; adb shell start package name/class name to start the application
2. View connected devices: adb devices
3. adb logcat: print log information
4. Send files to devices: adb push
5. Download File to computer: adb pull mobile phone file path computer target path
6. Screen capture command: adb shell screencap /sdcard/filename.png
7. Kill adb: adb kill-server
8. Adb connection application: adb connect ... (address)
9 , adb command control: adb shell
10, adb connect/disconnect: Remotely connect to mobile phone debugging through wifi.
11, adb shell am: am is the activity manager. 
Remarks : This command is used to perform some system actions, such as starting a specified activity and ending a process , send broadcasts, change screen properties, etc.

12. adb root: re-enter adb as root

13. adb remount refreshes the file system

14. adb pull sdcard/bk100 c:/ Take out all the files under the bk100 folder to the root directory of the c drive

15. adb push c:/log.txt sdcard/Copy the log file under the c disk to the root directory of the sdcard

16. adb shell am force-stop package name stop application

17. adb shell am kill package name stops the application and kills the process

18. adb install c:/a.apk install a.apk to the device

19. adb uninstall package name uninstall application

20. adb shell input tap 100,200 Click the screen x, y coordinates

21. adb shell input swipe 250 250 300 300 sliding operation

22. adb shell input keyevent 3 Simulate buttons, such as keycode=3 for home button and keycode=4 for back button

23. The studio can’t connect to the Nox simulator Solution: Enter the Nox bin directory——M:\Program Files (x86)\Nox\bin—execute the following command:
nox_adb.exe connect 127.0.0.1:62001

24、adb shell screencap <filename>

Get a screenshot of the device, such as adb shell screencap /sdcard/screen.png, and send it to the local: adb pull /sdcard/screen.png

Three, adb resource download

adbtoolforMAC-Android tool resource-CSDN download

4. Installation and use

  • Connect phone to computer via usb
  • In the phone settings, find [Developer mode], open [usb debugging mode]
  • Double click to install ADB Driver Installer
  • The recognized mobile phone will be displayed in the pop-up interface 
  • Enter [adb devices] to display a line of strings, indicating that the mobile phone is connected successfully, and you can enter the required command to perform the operation

Five, adb detailed introduction

GitHub - mzlogin/awesome-adb: ADB Usage Complete / ADB Usage Complete

Guess you like

Origin blog.csdn.net/weixin_37600187/article/details/84197924