ADB, short for Android debug bridge, is a tool in the android SDK. It can be used to directly manage Android simulators or real Android devices (such as G1 ~ 8 mobile phones ).
Its main functions include:
Run the shell of the device (command line)
Manage port ing between simulators and devices
Upload/download files between computers and devices
Install the local APK software on a simulator or Android device
ADB is a client-serverProgramThe client is the computer you use to operate, and the server is an Android device.
First, let's talk about the installation method. You need to install the client on your computer. The client is included in the SDK. You do not need to install it on the device. You just need to open the option settings-applications-Development-USB debugging on your mobile phone.
For Mac and Linux users, after the downloaded SDK is decompressed, you can ~ Or any directory. Then modify ~ /. Bash_profile file, set the runtime environment to point to the SDK's tools directory.
Open ~ /. Bash_profile file (if this file is not available, you can add it yourself), add a line in it:
Export path =$ {path }:< your SDK directory>/tools
For Windows users, add environment variables.
Then you can use the ADB command.
You can skip the installation steps and directly enter the full path to use the command, for example:
If you only want to use ADB and do not want to download the entire SDK, you can download this separate ADB toolkit and decompress the package to include adb.exe and adbwinapi. DLL files can be stored in the Windows/system32 folder on the system disk.
Now let's talk about several commands commonly used by ADB.
1. View Devices
ADB Devices
This command is used to view the currently connected devices. The Android devices or simulators connected to the computer are listed and displayed.
2. Install software
ADB install <APK file path>
This command installs the specified APK file on the device.
3. uninstall software
ADB uninstall <software Name>
ADB uninstall-k <software Name>
If the-k parameter is added, the software is uninstalled but the configuration and cache files are retained.
4. log on to the device Shell
ADB Shell
ADB shell <command>
This command will log on to the shell of the device.
The <command> command is used to directly run the device command, which is equivalent to executing the remote command.
5. Send files to the device from the computer
ADB push <local path> <remote path>
Use the push command to copy files or folders on the local computer to the device (mobile phone)
6. download files from your device to your computer
ADB pull <remote path> <local path>
Run the pull command to copy files or folders on the device (mobile phone) to the local computer.
7. display help information
ADB help
This command displays help information