Android adb command ~ Illustration

Source: Internet
Author: User
Tags unix domain socket

After such a long period of development and management, the command is always self-viewed, but the sharing process on the command is often ignored. So now I just need
Its command-related operations can be used for simple literacy, and the system also grants them fishing instead of fish in this way. Well, I will display it in graphic mode, of course, my habit is to read the help document or command first. The ADB command we want to explain here today can be detailed through command help in the command line, first:




The above is how to use help to display its related command instructions. Of course, if your English is good enough, these are actually very simple. Of course, if you are not used to reading these English descriptions, let me help you solve this problem. Well, I will translate and explain it in the most initial way. OK:
Android Debug Bridge version 1.0.29
This is about Android 1.0.29.

-D-directs command to the only connected USB device
The direct command is to connect the USB device.
Returns an error if more than one USB device is present.
If multiple USB devices appear at the same time, an error message is returned.
-E-directs command to the only running emulator.
Run the simulator directly using this command symbol
Returns an error if more than one emulator is running.
If multiple simulators run simultaneously, an error message is returned at the moment.
-S <serial number>-directs command to the USB device or emulator
The given serial number. Overrides ANDROID_SERIAL
Environment variable.
Use this direct command to display the serial number of the USB device or simulator. If the serial number is overwritten, the environment variable is variable.
-P <product name or path>-simple product name like 'sooner', or
A relative/absolute path to a product
Out directory like 'out/target/product/sooner '.
If-p is not specified, the ANDROID_PRODUCT_OUT
Environment variable is used, which must
Be an absolute path.
Use this command to display the product name, such as "sooner", or a relative and absolute product output path like "out/target/product/sooner". If-p is not specified, the ANDROID_PRODUCT_OUT environment variable will be used, but it must be an absolute path.
Devices-list all connected devices
Use this command to list all connected devices
Connect Port 5555 is used by default if no port number is specified.
Use the default port 5555 of TCP/IP to connect to the device
Disconnect [Port 5555 is used by default if no port number is specified.
Using this command with no additional arguments
Will disconnect from all connected TCP/IP devices.
You can use this command to disconnect a device from a TCP/IP. The default value is 5555 if no port is specified, using this command, you do not need to add a parameter to disconnect all connected devices from TCP/IP.
Device commands:
Device command:
Adb push <local> <remote>-copy file/dir to device
PUSH command: copy a file or directory to the device.
Adb pull <remote> [<local>]-copy file/dir from device
PULL command: copy a file or directory to the device.
Adb sync [<directory>]-copy host-> device only if changed
(-L means list but don't copy)
(See 'adb help all ')
SYNC: copy the host content to the device. It is only used to synchronize the content of the device when the device changes. The brackets indicate: I mean to list the content but do not need to copy it, refer to help ALL
Adb shell-run remote shell interactively
SHELL: run a remote SHELL to interact with it
Adb shell <command>-run remote shell command
SHELL: directly run the remote SHELL command
Adb emu <command>-run emulator console command
EMU: run the simulator monitoring information panel command
Adb logcat [<filter-spec>]-View device log
View device logs
Adb forward <local> <remote>-forward socket connections
Forward socket connection www.2cto.com
Forward specs are one:
A standard for display of forward specifications is:
Tcp: <port>
TCP port number
Localabstract: <unix domain socket name>
Local Abstraction: SOCKET name of UNIX domain name
Localreserved: <unix domain socket name>
Local Service: UNIX domain name/SOCKET name
Localfilesystem: <unix domain socket name>
Local file system: UNIX domain name/SOCKET name
Dev: <character device name>
Device: character device name
Jdwp: <process pid> (remote only)
Remote process ID
Adb jdwp-list PIDs of processes hosting a JDWP transport
Lists the transmission of a JAVA-debugged wireless protocol with the relevant process ID as the host process.
Speaking of JDWP, I will explain it briefly. It means that it is JDWP. The full write of JDWP is: Java Debug Wire Protocol, that is, the JAVA Debugger wireless Protocol, which defines the Debugger (Debugger) the communication protocol between the debugged Java Virtual Machine (target vm), here I want to explain more: Debugger and Target vm, the Target vm runs the program we want to debug, it is no different from the general running Java virtual machine. It only loads the Agent JDWP at startup and thus has the debugging function. The debugger is a well-known debugger. It sends commands to the running target vm to obtain the status of the target vm and control the execution of Java programs. Debugger and target vm run in their respective processes respectively. The communication protocol between them is JDWP. Unlike many other protocols, JDWP only defines the data transmission format, but does not specify a specific transmission mode. This means that the implementation of a JDWP can work normally in different transmission modes without any modification (details will be given in the JDWP transmission interface ). JDWP is language independent. Theoretically, we can use any language to implement JDWP. However, we note that the two ends of JDWP are target vm and debugger. On the Target vm end, the JDWP module must be loaded at the startup of the Java Virtual Machine in the form of Agent library, and it must implement various debug functions through the JVMTI interface provided by the Java Virtual Machine, therefore, it must be written in C/C ++. The debugger end does not have such restrictions and can be written in any language, as long as it complies with the JDWP specifications. JDI (Java Debug Interface) includes the implementation of a Java JDWP debugger (JDI will be introduced in the next article in this series ), the debugging tool jdb in JDK also uses JDI to complete its debugging function. The roles of the JDWP agent described above in debugging are as follows:

In fact, with a simple analysis of the protocol, we can learn the simple process of the handshake protocol:

Finally, let's take a look at its architecture:

Well, we have learned about JDWP from the above. For more details and operations, please refer to GOOGLE for details.
Adb install [-l] [-r] [-s] <file>-push this package file to the device and install it
('-L' means forward-lock the app)
('-R' means reinstall the app, keeping its data)
('-S' means install on SD card instead of internal storage)
Run this command to install the APK package to the device.-l means that the APP is locked for a long time.-r means that the APP needs to be re-installed and its data must be maintained, -s indicates that the device is installed in the SD card.
Adb uninstall [-k] <package>-remove this app package from the device
('-K' means keep the data and cache directories)
Run this command to uninstall the installed APK, that is, remove the package of the current APP from the device.-k means to keep the data domain cache directory.
Adb bugreport-return all information from the device
That shoshould be added in a bug report.
You can use this command to output and display the debugging information (device information ).

Adb backup [-f <file>] [-apk |-noapk] [-shared |-noshared] [-all] [-system |-nosystem] [<packages... >]
-Write an archive of the device's data to <file>.
If no-f option is supplied then the data is written
To "backup. AB" in the current directory.
(-Apk |-noapk enable/disable backup of the. apks themselves
In the archive; the default is noapk .)
(-Shared |-noshared enable/disable backup of the device's
Shared storage/SD card contents; the default is noshared .)
(-All means to back up all installed applications)
(-System |-nosystem toggles whether-all automatically between des
System applications; the default is to include system apps)
(<Packages...> is the list of applications to be backed up. If
The-all or-shared flags are passed, then the package
List is optional. Applications explicitly given on
Command line will be encoded ded even if-nosystem wocould
Ordinarily cause them to be omitted .)
You can use this command to back up its content,

Adb restore <file>-restore device contents from the <file> backup archive

Archive files backed up by Alibaba Cloud can be re-stored on devices.
Adb help-show this help message
Show Help Information
Adb version-show version num
Show De-version number
Scripting:
Script
Adb wait-for-device-block until device is online
When the device is online
Adb start-server-ensure that there is a server running
Start its service
Adb kill-server-kill the server if it is running
Run this command to kill the service that it runs.
Adb get-state-prints: offline | bootloader | device
Obtains the status of a device.
Adb get-serialno-prints: <serial-number>
Obtain a series of serial numbers
Adb status-window-continuously print device status for a specified device
Continuously print the specified device status
Adb remount-remounts the/system partition on the device read-write
Reinstalls the read/write operations on the devices.
Adb reboot [bootloader | recovery]-reboots the device, optionally into the bootloader or recovery program
Reload or restore the program.
Adb reboot-bootloader-reboots the device into the bootloader
Load the device that it restarts
Adb root-restarts the adbd daemon with root permissions
Get ROOT permission after restart
Adb usb-restarts the adbd daemon listening on USB
Restart to listen to USB
Adb tcpip <port>-restarts the adbd daemon listening on TCP on the specified port
Restart TCP to listen to the specified TCP port
Networking:
Network
Adb ppp <tty> [parameters]-Run PPP over USB.
 
Note: you shoshould not automatically start a PPP connection.
<Tty> refers to the tty for PPP stream. Eg. dev:/dev/omap_csmi_tty1
[Parameters]-Eg. defaultroute debug dump local notty usepeerdns


Adb sync notes: adb sync [<directory>]
<Localdir> can be interpreted in several ways:


-If <directory> is not specified, both/system and/data partitions will be updated.


-If it is "system" or "data", only the corresponding partition
Is updated.


Environmental variables:
ADB_TRACE-Print debug information. A comma separated list of the following values
1 or all, adb, sockets, packets, rwx, usb, sync, sysdeps, transport, jdwp
ANDROID_SERIAL-The serial number to connect to.-s takes priority over this if given.
ANDROID_LOG_TAGS-When used with the logcat option, only these debug tags are printed.
The above part will not be translated or understood due to time issues. In fact, the last few sentences are quite understandable. Please try again,
The following is a simple example:
Show logs: adb logcat | more

List devices: adb devices

OK. The above are two simple command columns. You can bring relevant parameters to verify the command according to the actual situation, I hope to give you some reference and learning .......
 


Detailed description of android Application Development

Related Article

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.