版本信息:Android Debug Bridge version 1.0.41,今天小编就来说说关于手机端如何运行adb指令?下面更多详细答案一起来看看吧!

手机端如何运行adb指令(手机调试命令adb的详细用法)

手机端如何运行adb指令

版本信息

Android Debug Bridge version 1.0.41

Version 29.0.4-5871666

Installed as c:\tmp\fastboot\adb.exe

一、global options: (全局选项)

二、general commands:(常用命令)

查看连接的设备,显示出设备号和状态。当设备处于正常连接、bootloader、recovery、sideload时,状态对应为:device/fastboot/recovery/sideload。unauthorized是设备端未授权。

c:\tmp\fastboot>adb devices List of devices attached ZHP7UCQCFUKNEMBQ device

c:\tmp\fastboot>adb version Android Debug Bridge version 1.0.41 Version 29.0.4-5871666 Installed as c:\tmp\fastboot\adb.exe

三、networking: (网络功能)

connect HOST[:PORT] connect to a device via TCP/IP (设备与电脑同一局域网)

通过网络连接设备,默认端口是:5555

c:\tmp\fastboot>adb connect 192.168.0.4 cannot connect to 192.168.0.4:5555: 由于目标计算机积极拒绝,无法连接。 (10061)

disconnect [[HOST]:PORT] disconnect from given TCP/IP device, or all

forward --list list all forward socket connections

forward [--no-rebind] LOCAL REMOTE

forward socket connection using:

tcp:<port> (<local> may be "tcp:0" to pick any open port)

localabstract:<unix domain socket name>

localreserved:<unix domain socket name>

localfilesystem:<unix domain socket name>

dev:<character device name>

jdwp:<process pid> (remote only)

forward --remove LOCAL remove specific forward socket connection

forward --remove-all remove all forward socket connections

ppp TTY [PARAMETER...] run PPP over USB

reverse --list list all reverse socket connections from device

reverse [--no-rebind] REMOTE LOCAL

reverse socket connection using:

tcp:<port> (<remote> may be "tcp:0" to pick any open port)

localabstract:<unix domain socket name>

localreserved:<unix domain socket name>

localfilesystem:<unix domain socket name>

reverse --remove REMOTE remove specific reverse socket connection

reverse --remove-all remove all reverse socket connections from device

四、file transfer: (文件传输功能)

push [--sync] LOCAL... REMOTE 将电脑上的文件传到设备上

copy local files/directories to device

--sync: only push files that are newer on the host than the device

c:\tmp\fastboot>adb push c:/tmp/adbd-Insecure-v2.00.apk /sdcard/ c:/tmp/adbd-Insecure-v2.00.apk: 1 file ...shed. 7.3 MB/s (752250 bytes in 0.099s)

pull [-a] REMOTE... LOCAL 将设备上的文件下载到电脑上

copy files/dirs from device

-a: preserve file timestamp and mode

adb pull /sdcard/adbd-Insecure-v2.00.apk c:/tmp/

sync [all|data|odm|oem|product|system|system_ext|vendor]

sync a local build from $ANDROID_PRODUCT_OUT to the device (default all)

-l: list files that would be copied, but don't copy them

五、shell: (shell功能)

shell [-e ESCAPE] [-n] [-Tt] [-x] [COMMAND...]

run remote shell command (interactive shell if no command given)

进入shell命令模式或直接执行sh命令:

c:\tmp\fastboot>adb shell shell@bbk82_wet_jb5:/ $ c:\tmp\fastboot>adb shell ls -l /system/ drwxrwxrwx root root 2022-02-19 20:07 app drwxr-xr-x root shell 2022-02-24 09:53 bin -rw-r--r-- root root 4289 2015-03-10 11:55 build.prop drwxr-xr-x root root 2008-08-01 20:00 com.bbk.arcsoft drwxr-xr-x root root 2008-08-01 20:00 etc drwxr-xr-x root root 2008-08-01 20:00 fonts ...

emu COMMAND run emulator console command

六、app installation (see also `adb shell cmd package help`): (应用安装)

install [-lrtsdg] [--instant] PACKAGE 安装本地(电脑端)的APP到设备上

push a single package to the device and install it

c:\tmp\fastboot>adb install c:/tmp/adbd-Insecure-v2.00.apk Performing Push Install c:/tmp/adbd-Insecure-v2.00.apk: 1 file ...shed. 7.5 MB/s (752250 bytes in 0.096s) pkg: /data/local/tmp/adbd-Insecure-v2.00.apk Failure [INSTALL_FAILED_ALREADY_EXISTS]

install-multiple [-lrtsdpg] [--instant] PACKAGE...

push multiple APKs to the device for a single package and install them

install-multi-package [-lrtsdpg] [--instant] PACKAGE...

push one or more packages to the device and install them atomically

(See also `adb shell pm help` for more options.)

uninstall [-k] PACKAGE

remove this app package from the device

'-k': keep the data and cache directories

七、debugging: (调试功能)

bugreport [PATH]

write bugreport to given PATH [default=bugreport.zip];

if PATH is a directory, the bug report is saved in that directory.

devices that don't support zipped bug reports output to stdout.

jdwp list pids of processes hosting a JDWP transport

logcat show device log (logcat --help for more)

八、security:

九、scripting:

wait-for[-TRANSPORT]-state

wait for device to be in the given state

get-state print offline | bootloader | device 取得设备的状态

c:\tmp\fastboot>adb get-state device

get-serialno print <serial-number> 取得设备号

c:\tmp\fastboot>adb get-serialno ZHP7UCQCFUKNEMBQ

get-devpath print <device-path>

remount [-R] 将分区挂载为可读写

remount partitions read-write. if a reboot is required, -R will automatically reboot the device.

reboot [bootloader|recovery|sideload|sideload-auto-reboot] 重启到各种模式

reboot the device; defaults to booting system image but supports bootloader and recovery too. sideload reboots into recovery and automatically starts sideload mode, sideload-auto-reboot is the same but reboots after sideloading.

默认是正常启动

adb reboot 重启设备 adb reboot bootloader 启动到fastboot模式 adb reboot recovery 启动到recovery模式 adb reboot sideload 启动到sideload传输模式

sideload OTAPACKAGE sideload the given full OTA package

root restart adbd with root permissions 以root的权限来运行adb

adb root

unroot restart adbd without root permissions

usb restart adbd listening on USB

tcpip PORT restart adbd listening on TCP on PORT 修改设备端的网络侦听端口

adb tcpip 9999 (默认是5555)

十、internal debugging:

c:\tmp\fastboot>adb kill-server c:\tmp\fastboot>adb start-server * daemon not running; starting now at tcp:5037 * daemon started successfully

十一、environment variables:


特殊功能:备份和恢复

详细用法在另一篇文章中说明。

,