Android notes adb Command Parsing 1, androidadb

Source: Internet
Author: User
Tags unix domain socket

Android notes adb Command Parsing 1, androidadb

I have been learning Android for a long time and keep my diary in evernote. I plan to sort the logs in evernote over and over again and publish them to the Internet for sharing as soon as I leave my company idle.


To directly use adb in the cmd command, you need to configure the environment variable: Directory XXX \ sdk \ platform-tools

View the adb-help command to print the following content:

Android Debug Bridge version 1.0.31 <! -- Android debugging bridge version: 1.0.31 -->

-A-directs adb to listen on all interfaces for a connection
<! -- A parameter indicates that adb listens to all interfaces connected. -->

-D-directs command to the only connected USB device
Returns an error if more than one USB device is present.
<! -- D parameter, indicating that the command is only used to connect to a USB device
If multiple USB devices exist at the same time, an error is returned.
-->

-E-directs command to the only running emulator.
Returns an error if more than one emulator is running.
<! -- E parameter, indicating that only the running simulator is connected --
If more than one simulator is running, an error is returned.
-->

-S <specific device>-directs command to the device or emulator with the given
Serial number or qualifier. Overrides ANDROID_SERIAL environment variable.

<! The -- s <specific device> parameter specifies the device or Simulator Based on the specified serial number or modifier <specific device>.

Override ANDROID_SERIAL environment variables.
-->

-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.


<! -- P <product name or path> (product name or path) parameter to display the name of the product, for example, "sooner", or
Is a relative/absolute product output path, such as "out/target/product/sooner ".
If-p is not specified, the ANDROID_PRODUCT_OUT environment variable will be used, which must be an absolute path.

-->

-H-Name of adb server host (default: localhost)

<! ---H parameter, indicating the adb service host name -->

-P-Port of adb server (default: 5037)
<! -- P parameter, indicating the adb service port number -->

Devices [-l]-list all connected devices
('-L' will also list device qualifiers)

<! -- Adb devices [-l]: This command can be used to list all connected devices.
The '-l' parameter is added to list device modifiers.
Eg: adb devices-l
List of devices attached
Da0b232e device product: jflteuc model: GT_I9500 device: jflteatt
-->

Connect Port 5555 is used by default if no port number is specified.

<! -- Adb connect -->

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.

<! -- Adb disconnect [If no port is specified, use the default port 5555.
Using this command without adding additional parameters will disconnect all TCP/IP devices.
-->

Device commands:
<! -- Device command -->
Adb push [-p] <local> <remote>
-Copy file/dir to device
('-P' to display the transfer SS)

<! -- Adb push [-p] <local> <remote> command: copy a file/directory to the device --
-P parameter is specified to display the transmission progress
-->

Adb pull [-p] [-a] <remote> [<local>]
-Copy file/dir from device
('-P' to display the transfer SS)
('-A' means copy timestamp and mode)

<! -- Adb pull [-p] [-a] <remote> [<local>] command: copy a file/directory from the device
-P parameter is specified to display the transmission progress
-A indicates the replication Timestamp and mode.
-->

Adb sync [<directory>]-copy host-> device only if changed
(-L means list but don't copy)
(See 'adb help all ')

<! -- Adb sync [<directory>] command: copy the host content to the device and synchronize the content only after the device content changes.
-L indicates listing but not copying
See the adb help all command.
-->

Adb shell-run remote shell interactively
<! -- Adb shell command: Interactive Operation with remote shell.
-->

Adb shell <command>-run remote shell command
<! -- Adb shell <command> command: run the remote shell command

For example, adb shell ls-l
-->

Adb emu <command>-run emulator console command

<! -- Adb emu <command> command: run the simulator Console command
-->

Adb logcat [<filter-spec>]-View device log

<! -- Adb logcat command: View device logs
-->

Adb forward -- list-list all forward socket connections.
The format is a list of lines with the following format:
<Serial> "" <local> "" <remote> "\ n"

<! -- Adb forward -- list command: Lists All forwarded socket connections.
The format is a row list in the following format:
<Serial> "" <local> "" <remote> "\ n"
-->

Adb forward <local> <remote>-forward socket connections
Forward specs are one:
<! -- Adb forward <local> <remote> command: the user forwards the port <local> specified by the PC to the port <remote> specified by the device.
The forwarding specification of the forwarding socket connection is as follows: -->
Tcp: <port>
<! -- Tcp: <port number> -->
Localabstract: <unix domain socket name>
<! -- Localabstract: <unix domain socket name> -->
Localreserved: <unix domain socket name>
<! -- Localreserved: <unix domain socket name> -->
Localfilesystem: <unix domain socket name>
<! -- Localfilesystem: <unix domain socket name> -->
Dev: <character device name>
<! -- Dev: <character device name> -->
Jdwp: <process pid> (remote only)
<! -- Jdwp: <remote process no.> -->
<! --
Note:
Unix domain socket
See http://zh.wikipedia.org/wiki/Unix_domain_socket
Jdwp
See http://zh.wikipedia.org/wiki/JPDA

1. eg:
Adb forward tcp: 6100 tcp: 7100 // All port 6100 communication data on the PC will be redirected to the mobile phone end/simulator port 7100 server
2. eg:
Adb forward tcp: 6100 local: logd // All port 6100 communication data on the PC will be redirected to the mobile phone/simulator UNIX socket

-->

Adb forward -- no-rebind <local> <remote>
-Same as 'adb forward <local> <remote> 'but fails

<! --
If -- no-rebind is specified, the same adb forward <local> <remote> command fails.
-->

If <local> is already forwarded

<! -- If <local> already forwarded -->

Adb forward -- remove <local>-remove a specific forward socket connection

<! -- Adb forward -- remove <local> remove a specified forwarding socket connection -->

Adb forward -- remove-all-remove all forward socket connections

<! -- Adb forward -- remove-all remove all forwarding socket connections -->

Adb jdwp-list PIDs of processes hosting a JDWP transport

<! -- Adb jdwp displays the pid list of processes hosted in a jdwp transmission -->

Adb install [-l] [-r] [-d] [-s] [-- algo <algorithm name> -- key Y> -- iv

-Push this package file to the device and install it
('-L' means forward-lock the app)
('-R' means reinstall the app, keeping its data
)
('-D' means allow version code downgrade)
('-S' means install on SD card instead of internal storage)
('-- Algo', '-- key', and' -- iv 'mean the file is encrypted already)

<! --
Adb install [-l] [-r] [-d] [-s] [-- algo <algorithm name> -- key Y> -- iv -L indicates the locked APP,
-R indicates re-installing the app and retaining the original data,
-D indicates that version code downgrade is allowed.
-S indicates that it is installed on the SD card instead of internal storage.
'-- Algo', '-- key', and' -- iv 'indicates that the file has been encrypted.
-->


Adb uninstall [-k] <package>-remove this app package from the device
('-K' means keep the data and cache directories
)

<! --
The adb uninstall [-k] <package> command is used to delete the APK package installed on the device,
-K indicates that the data and cache directory are retained.
-->

Adb bugreport-return all information from the device that should be stored in a bug report.

<! --
Adb bugreport outputs all device information, which is included in the defect report.
-->

Adb backup [-f <file>] [-apk |-noapk] [-obb |-noobb] [-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 .)
(-Obb |-noobb enable/disable backup of any installed apk expansion
(Aka. obb) files associated with each application; the default is noobb .)
(-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 supported 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 the command line will be supported DED
Even if-nosystem wowould ordinarily cause them to be omitted .)

<! -- Adb backup [-f <file>] [-apk |-noapk] [-obb |-noobb] [-shared |-noshared] [-all]
[-System |-nosystem] [<packages...>] writes data from a device to an archive file <file> (PC directory file ).
If the-f option is not provided, data is written to the backup. AB file in the current directory.
-Apk |-noapk enables/disables the backup of your own apk files to archive files. Disabled by default.
-Obb |-noobb enables/disables backup of any installed apk extension files (also known as. obb files (opaque binary blobs) associated with each application ))
-Shared |-noshared enable/disable shared storage/SD card content backup. Disabled by default.
-All: Back up all installed applications. -All automatically includes system applications by default.
-System |-nosystem: Specifies whether to switch to include system applications. System applications are included by default.
<Packages...> list of applications to be backed up
If you have used the-all or-shared tag, the package list <packages...> is optional.
The application is explicitly included in the command line, even if the-nosystem flag specifies to ignore the system application.
-->

Adb restore <file>-restore device contents from the <file> backup archive
<! -- Adb restore <file> restore device content through the backup archive file -->
Adb help-show this help message
<! -- Adb help displays adb help information -->
Adb version-show version num
<! -- Adb version: displays the adb version. -->

Scripting:
<! -- Script -->
Adb wait-for-device-block until device is online
<! -- Adb wait-for-device wait till the device is online -->

Adb start-server-ensure that there is a server running
<! -- Adb start-server: Make sure the service is running -->

Adb kill-server-kill the server if it is running
<! -- Adb kill-server: kill a running service -->

Adb get-state-prints: offline | bootloader | device
<! -- Adb get-state: offline | bootloader | device -->

Adb get-serialno-prints: <serial-number>
<! -- Adb get-serialno: print the device serial number information -->

Adb get-devpath-prints: <device-path>
<! -- Adb get-devpath: print the device path -->

Adb status-window-continuously print device status for a specified device
<! -- Adb status-window: continuously prints the specified device status -->

Adb remount-remounts the/system partition on the device read-write
<! -- Adb remount re-mounts the system partition read/write of the device -->

Adb reboot [bootloader | recovery]-reboots the device, optionally into the bootloader or recovery program
<! -- Adb reboot restarts the device. You can choose to enter the boot program or recover the program. -->

Adb reboot-bootloader-reboots the device into the bootloader
<! -- Adb reboot-bootloader restarts the device and enters the boot program (flash mode ). -->

Adb root-restarts the adbd daemon with root permissions
<! -- Adb root restarts the adbd background process to obtain the ROOT permission -->

Adb usb-restarts the adbd daemon listening on USB
<! -- Adb usb restarts the adbd background process to listen to USB -->

Adb tcpip <port>-restarts the adbd daemon listening on TCP on the specified port
<! -- Adb tcpip <port> restart the adbd background process 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. default route 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.


<! --
Adb ppp <tty> [parameters]-PPP running on USB.

Note: you cannot automatically start the PPP connection.

<Tty> the tty is a PPP stream. For example. Dev:/dev/omap_csmi_tty1 [parameters]
-Example. Default route debugging discards local notty usepeerdns

Adb sync notes: adb sync [<directory>]

<Localdir> there are several ways to explain:

-If the <directory>/system and/data partitions are not specified, the partitions are updated.

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

-->

Environmental variables:
<! -- Environment variable -->

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
<! --
ADB_TRACE environment variable-print debugging information. Use commas to separate one or all of the following: 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_SERIAL-connected serial number. If the-s parameter is given, its priority will be higher than this environment variable. -->

ANDROID_LOG_TAGS-When used with the logcat option, only these debug tags are printed.
<! -- ANDROID_LOG_TAGS environment variable.-When you use the logcat option, only these debugging labels will be printed. -->

The official adb tool documentation can be found:
Http://developer.android.com/tools/help/adb.html

 

Author: sufish
Source: http://www.cnblogs.com/dotnetframework/

The copyright of this article is shared by the author and the blog. You are welcome to repost this article, but you must keep this statement without the author's consent and provide a connection to the original article on the article page. If you have any questions, you can mail: dotnetframework@sina.com contact me, thank you very much.

 

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.