The common commands of the Android adb

Source: Internet
Author: User
Tags socket unix domain socket port number

 1. Query for several Android devices to connect to ADB server
>ADB devices
List of devices attached
0123456789ABCDEF device
2. Install a apk to the Android device
>adb install-r b:test6577pinyinime.apk
2509 kb/s (1284852 bytes in 0.499s)
Pkg:/data /local/tmp/pinyinime.apk
Success
-R indicates a forced installation, and this option is used when the APK is originally in the system to ensure that a new apk is installed.
3. Copy files from local to device
>ADB push B:test6577pinyinime.apk/data/app
3491 kb/s (1284852 bytes in 0.359s)
4. Copying files from a device To the local
>adb pull/data/app./
pull:building file List ...
Pull:/data/app/com.android.inputmethod.pinyin-2.apk->./com.android.inputmethod.pinyin-2.apk
Pull:/ data/app/pinyinime.apk->./pinyinime.apk
Pull:/data/app/com.google.android.inputmethod.pinyin-1.apk->. /COM.GOOGLE.ANDROID.INPUTMETHOD.PINYIN-1.APK
3 files pulled. 0 files skipped.
4766 kb/s (10981224 bytes in 2.249s)
This command means that all apk in the/data/app directory in the device are copied to the local current directory.
5. Enter the shell
so that you can knock commands like under Linux.
>adb Shell
root@android:/# logcat
6. Restart ADB server
>adb kill-server
>adb start-server
* Daemon not running. Starting it now on port 5037 *
* Daemon started successfully *
These commands are really often used, must remember OH ~
ADB also has many uses, can use ADB help.
>adb help
The Android Debug Bridge version 1.0.26


-d-directs command to the only connected USB device
Returns a error if more than one USB device is present.
-e-directs command to the only running emulator.
Returns an error if more than one emulator is running.
-S <serial number>-directs command to the USB device or emulator with
the given number. Overrides android_serial
environment 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 isn't specified, the Android_product_out
environment variable is used, which must
being an absolute path.
Devices-list all connected devices
Connect Port 55 Used by default if no port number is specified.
Disconnect [ Port 5555 is used by default if no Port number is specified. The
Using this ocmmand with no additional arguments
'll disconnect from all connected TCP/IP devices.

 


Device Commands:
adb push <local> <remote>-copy File/dir to device
ADB pull <remote> [ <LOCAL>]-copy file/dir from device
adb sync [<directory>]-copy host->device only if changed
( -L means list but don ' t copy
("adb help All")
adb shell-run remote shell interactively
adb shell <co mmand>-run Remote shell command
ADB EMU <command>-run Emulator console command
adb logcat [<filte R-spec>]-View device log
adb forward <local> <remote>-forward socket connections
Forward Specs Are one of:
Tcp:<port>
Localabstract:<unix domain socket name>
Localreserved:<unix Domain Soc Ket name>
Localfilesystem:<unix domain socket name>
Dev:<character device name>
jdwp:< Process pid> (remote only)
ADB jdwp-list PIDs of processes hosting a JDWP transport
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)
ADB uninstall [K] <package>-Remove thi S app package from the device
(' k ' means keep the data and cache directories)
adb bugreport-return all Informat Ion from the device
that should is included in a bug.

ADB help-show this Help message
ADB version-show version num


Dataopts:
(no option)-don ' t touch the data partition
-w-wipe the data partition
-d-flash the data partition


Scripting:
adb wait-for-device-block until device is online
adb start-server-ensure This there is a SE RVer running
ADB kill-server-kill the server if it is running
adb get-state-prints:offline | bootloader | dev Ice
adb get-serialno-prints: <serial-number>
adb status-window-continuously print device status for a SP ecified device
adb remount-remounts the/system partition on the device read-write
adb reboot [Bootloader|recove RY]-reboots the device, optionally into the bootloader or recovery program
ADB reboot-bootloader-reboots the Devic E into the bootloader
adb root-restarts the adbd daemon with root permissions
adb usb-restarts the ADBD daemon Listening on USB
adb tcpip <port>-Restarts the adbd daemon listening on TCP on the specified port
Network ING:
adb PPP <tty> [parameters]-Run PPP over USB.
Note:you should 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 is interpreted in several ways:


-If <directory> are not specified, Both/system and/data partitions'll 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 is only the debug TAGS are printed.

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.