Use of general ADB commands

Source: Internet
Author: User

Http://blog.csdn.net/harry_helei/article/details/5966630

ADB (Android debug Bridge) is one of the supporting command line tools for Android system development. developers use this tool to interact with simulators and Android devices through command lines or scripts. Before using this command, it is best to add the file directory of the command to the standard search path of the system. The following commands are based on this practice. I use these commands on the Ubuntu terminal.

ADB help: Query help information

ADB version: ADB tool version query command

These commands are meaningless.

The top command I want to describe is ADB devices, which is used to display all connected devices. This command is introduced first because I mentioned in the previous article that you need to use this command to check whether the connection to the PC is successful during device connection. After you type this command on the terminal, all connected devices, including all open simulators, are listed. However, when I used it for the first time, I encountered such a problem. After I typed the command, all the simulators were displayed as normal, but the Android phone connected was prompted as follows:

???????????? No permission

It seems that the system permission for running the ADB command is not enough. You can switch the operation permission to the root account, but you still cannot do it. You can check it online and there are many people who encounter such problems, the reason is that when the ADB service is enabled, it is not performed under root. The solution is simple. First, enter the command ADB kill-server on the terminal to disable the ADB service. Then, enter the command sudo ADB start-server. Finally, enter the command ADB devices.

ADB start-server: Start the ADB service. For usage instructions, see the problem solving section in the ADB devices command.

ADB kill-server: Disable the ADB service. For usage instructions, see the problem solving section in the ADB devices command.

ADB install [Options] <File Name>: Installation command of the application package (.apk). The command executes two actions: first, push the package to the device, and then complete the package installation. If the current PC is connected to both a simulator and a development device (such as a mobile phone), add the-D (device) and-E (emulate) to specify which devices to install, such as ADB-D install xxx.apk, to install it on the development device. [Options] is an option for the install command, which includes the following:

-L: Forward lock Program (I do not understand what this means currently)

-R: overwrite the installer and keep the existing data unchanged.

-S: install it on the SD card instead of the internal storage space. This option is valid for versions earlier than Android 2.2. from Android, it is installed on the SD card by default.

ADB uninstall [-K] <package>: uninstall the installation package. It can be roughly understood as the reverse operation of the above install command. However, the command parameters are different. Here, the installer is uninstalled, not the file name. To obtain the installation package name, run the ADB shell command to enter the device and search for it in the/data directory. Option-k indicates that data and files are retained.

ADB push <local directory/File> <Device directory>: sends the specified local directory or file to the Device directory. For example, push/home/helei/123.mp3/sdcard sends a file named 123.mp3 in the/home/heleidirectory of my local computer to the SD card of the device, in this way, you can play the music file locally on the device.

ADB pull <Device directory/File> <local directory>: copy the directory or file specified by the device to the local directory.

ADB shell: log on to the terminal of the remote device and execute common Linux commands supported by the device, such as-L and CD. The exit command is exit.

In addition to the preceding commands, there are also some commands related to data synchronization, network connection, and device information query. You can view the help information through ADB help.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.