Android adb 命令

查看設備

  * adb devices

  這個命令是查看當前連接的設備, 連接到計算機的android設備或者模擬器將會列出顯示

  安裝軟件

  * adb install

  這個命令將指定的apk文件安裝到設備上.

  卸載軟件

  * adb uninstall <軟件名>

  * adb uninstall -k <軟件名>

  如果加 -k 參數,爲卸載軟件但是保留配置和緩存文件.

  登錄設備shell

  * adb shell

  * adb shell

  這個命令將登錄設備的shell.

  後面加將是直接運行設備命令, 相當於執行遠程命令

  從電腦上發送文件到設備

  * adb push <本地路徑> <遠程路徑>

  用push命令可以把本機電腦上的文件或者文件夾複製到設備(手機)

  從設備上下載文件到電腦

  * adb pull <遠程路徑> <本地路徑>

  用pull命令可以把設備(手機)上的文件或者文件夾複製到本機電腦

  顯示幫助信息

  * adb help

  這個命令將顯示幫助信息

  這裏還有一個英文版的:

  在DOS下輸入以下命令基本可以完成刷機任務,一些常用命令解釋如下:

  adb devices - 列出連接到電腦的ADB設備(也就是手機),一般顯示出手機P/N碼.如果沒有顯示出來則手機與電腦沒有連接上.

  adb install – 安裝手機軟件到手機中,如:adb install qq2009.apk.

  adb remount – 重新打開手機寫模式(刷機模式).

  adb push - 傳送文件到手機中,如:adb push recovery.img /sdcard/recovery.img,將本地目錄中的recovery.img文件傳送手機的SD卡中並取同樣的文件名.

  adb pull - 傳送手機的文件到本地目錄(和上命令相反).

  adb shell - 讓手機執行命令,就是手機執行的命令.如: adb shell flash_image recovery /sd-card/recovery-RAv1.0G.img,執行將recovery-RAv1.0G.img寫入到recovery 區中.

  我們刷recovery時一般按下順序執行:

  adb shell mount -a

  adb push recovery-RAv1.0G.img /system/recovery.img

  adb push recovery-RAv1.0G.img /sdcard/recovery-RAv1.0G.img

  adb shell flash_image recovery /sdcard/recovery-RAv1.0G.img reboot

  其它的自己靈活運用了.

  ADB命令詳解:

  Android Debug Bridge version 1.0.20

  -d  - directs command to the only connected USB device returns an 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 – directs command to the USB device or emulator withthe given serial number

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

  devices   – list all connected devices

  device commands:

  adb push – copy file/dir to device

  adb pull – copy file/dir from device

  adb sync [ ] – copy host->device only if changed (see ‘adb help all’)

  adb shell – run remote shell interactively

  adb shell – run remote shell command

  adb emu – run emulator console command

  adb logcat [ ] – View device log

  adb forward – forward socket connections

  forward specs are one of:

  tcp:

  localabstract:

  localreserved:

  localfilesystem:

  dev:

  jdwp: (remote only)

  adb jdwp  – list PIDs of processes hosting a JDWP transport

  adb install [-l] [-r] – push this package file to the device and install it

  (‘-l’ means forward-lock the app)

  (‘-r’ means reinstall the app, keeping its data)

  adb uninstall [-k] – remove this app package from the device

  (‘-k’ means keep the data and cache directories)

  adb bugreport – return all information from the device that should be included in a bug report.

  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 that there is a server running

  adb kill-server – kill the server if it is running

  adb get-state – prints: offline | bootloader | device

  adb get-serialno – prints:

  adb status-window – continuously print device status for a specified device

  adb remount – remounts the /system partition on the device re

  ad-write

  adb root – restarts adb with root permissions

  networking:

  adb ppp [parameters] – Run PPP over USB.

  Note: you should not automatically start a PDP connection.

  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 [ ]

  can be interpreted in several ways:

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

  - If it is “system” or “data”, only the corresponding partition is updated


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章