ADB (two)---commonly used commands

1. Query equipment:

        adb devices : display a list of connected devices

  • Serial number: A string created by adb, used to uniquely identify the device through the port number. The following is an example of a serial number:ebd568f7

  • Status: The connection status of the device can be one of the following:

    • offline: The device is not connected to adb or is not responding.

    • device: The device is now connected to the adb server. Please note that this status does not mean that the Android system has been fully booted up and can operate normally, because the system is still booting up when the device is connected to adb. However, after startup, this will be the normal operating state of the device.

    • no device: No device is connected.

  • Description: -l parameter, display detailed information of the device

          

 

2. Install the application

        adb install path_to_apk: install the application    

  • -r: Reinstall the existing application and keep its data.

  • -t: Allow to install test APK

  • -i installer_package_name: Specify the name of the installer package.

  • --install-location location: Use one of the following values ​​to set the installation location:

    • 0: Use the default installation location.

    • 1: Install on internal device storage.

    • 2: Install on external media.

  • -f: Install the software package on the internal system memory.

 

3. Uninstall the app

        adb uninstall package: remove the package from the system

  • -f: Keep the data and cache directory after removing the package

 

4. Copy files to/from the device

(1) adb pull remote local: copy a file or directory (and its subdirectories) from the device to the host

(2) adb push local remote: copy a file or directory (and its subdirectories) from the host to the device

 

5. Stop adb service       

        adb kill-server: stop the background adb service

 

6. Issue the adb command

       adb [-d | -e | -s serial_number] command: issue adb command, if it is multiple devices, add -d/-e/-s parameter

 

7. Issue shell commands

(1) If you need to issue a single command, please use the shell command, as shown below:

         adb [-d |-e | -s serial_number] shell shell_command

        

(2) To start an interactive shell on the device, use the  shell command as shown below:

         adb [-d | -e | -s serial_number] shell

       

(3) If you want to exit the interactive shell, you can use Crtl+D or exit

       

(4) List of Unix command line tools: adb [-d | -e | -s serial_number] shell ls /system/bin

        

  

 

Guess you like

Origin blog.csdn.net/qq_19982677/article/details/115213067