Use of the ADB Tool,
ADB is the debugging Bridge of Android Debug Bridge. It can be used to Debug and manage the statuses of Android devices and device simulators. For example, run Shell on Android devices and transfer files between computers and devices...
So the question is, where can I obtain ADB and how can I use it? I hope you can help me in the following section ~
Download ADB
If you already have the Android SDK, you can find the adb tool under platform-tools in the SDK directory.
If you do not have one, click here to download it from the online storage, password kokk, download it, decompress it, and open cmd from the decompressed file.
Tips: If you often use the adb tool, it will be troublesome to open cmd from the file every time. You can consider adding the Path of adb to the Path of the system environment variable, you can directly use adb to run cmd anywhere in the future.
After the download is complete, you can connect to the device,
Connect devices
1. Enable the USB debugging option of the device.
Generally, Android phones Enable USB: Enable "Settings", find "about mobile phones", and continuously click the version number to enter developer mode multiple times --> Find the developer option in settings and enable USB debugging
2. Connect the device to the computer using a USB data cable. Open cmd and enter the command adb devices to test whether the connection is successful. If a message is displayed, the connection is successful:
The front is the device number, followed by the device status
If no connection is successful, there are two common causes for reference:
① USB debugging is not enabled or disabled: USB debugging on some mobile phones may be automatically disabled if it is not used for a period of time.
Solution: Re-Enable USB debugging and re-connect whether the connection is successful
② Port 5037 occupied: the port number listened for when connecting to the USB device is 5037. If the port number is occupied by other processes, the adb connection will fail.
Solution: Enter netstat-ano | findstr "5037" in cmd, and the occupied process is displayed, as shown in:
3324 on the right is the PID of the process. Open the task manager to view the details, find the process whose PID is 3324, right-click the process to end, and then retry adb to check whether the connection is successful.
After adb successfully connects to the device, you can start to use the command,
Common adb commands
1. adb install [optional parameter] <apk or file path>
Install the apk file in the specified path on the computer to the device
Chestnut: adb install C: \ xxx.apk
Optional parameter [-r] If the software already exists on the device, you can reinstall the software.
Chestnut: adb install-r xxx.apk
2. adb uninstall [optional parameter] <apk File>
Uninstall software on the device
Chestnut: adb uninstall xxx.apk
Optional parameter [-k] uninstall the software on the device and retain the configuration file and cache file
Chestnut: adb uninstall-k xxx.apk
If multiple devices are connected, use the-s parameter to specify the device to operate.
Chestnut: adb-s emulator-5554 uninstall-k xxx.apk
3. adb shell
Log on to the Shell (command line) of the device and run the Linux Command
Adb shell <command>
Run commands directly
4. adb help
Display adb help information
5. adb push <local path> <remote path>
Send local computer files to the specified path of the device
Chestnut: adb push C: \ Users \ hp \ Pictures \ xxx.jpg/sdcard
6. adb pull <remote path> <local path>
Sends the specified file on the device to the specified path on the computer.
Chestnut: adb pull/sdcard/xxx.jpg C: \ Users \ hp \ Pictures
6. adb get-product
Obtain the device ID.
Adb get-serialno
Obtains the serial number of a device.
7. adb devices
View the list of current devices or simulators and their status
8. adb bugreport
View bug reports
9. adb reboot
Restart the device
10. adb shell dumpsys [optional parameter]
Output device information
Chestnut: adb shell dumpsys battery
11. adb shell screencap <remote path>
Device screenshot and save the image to the specified path
Chestnut: adb shell screencap/sdcard
12. adb root
Enter adb as root
13. adb version
View adb version
14. adb start-server
Start adb Service
Adb kill-server
Disable adb Service
Welcome to correction and supplement ~ Thank you.