adb.exe是什麼進程 adb.exe命令詳解

點評:ADB全稱Android Debug Bridge, 是android sdk裡的一個工具, 用這個工具可以直接操作管理android模擬器或者真實的andriod設備(如G1手機)

ADB全稱Android Debug Bridge, 是android sdk裡的一個工具, 用這個工具可以直接操作管理android模擬器或者真實的andriod設備(如G1手機).
它的主要功能有:

* 運行設備的shell(命令行)
* 管理模擬器或設備的端口映射
* 計算機和設備之間上傳/下載文件

* 將本地apk軟件安裝至模擬器或android設備

ADB是一個 客戶端-服務器端 程序, 其中客戶端是你用來操作的電腦, 服務器端是android設備..
先說安裝方法, 電腦上需要安裝客戶端. 客戶端包含在sdk裡. 設備上不需要安裝, 隻需要在手機上打開選項settings-applications-development-USB debugging.

對於Mac和Linux用戶, 下載好的sdk解壓後, 可以放~或者任意目錄. 然後修改~/.bash_profile文件, 設置運行環境指向sdk的tools目錄.
具體是打開~/.bash_profile文件(如果沒有此文件也可以自行添加), 在裡面加入一行:
export PATH=${PATH}:<你的sdk目錄>/tools

然後就可以使用adb命令瞭.



嫌安裝麻煩的同學其實也可以省去上面安裝步驟, 直接輸入完整路徑來使用命令。

對於windows xp用戶, 需要先安裝usb驅動 android_usb_windows.zip, 然後如果你隻打算使用adb而不想下載整個sdk的話, 可以下載這個單獨的adb工具包 adb_win.zip 下載後解壓, 把裡面 adb.exe 和 AdbWinApi.dll 兩個文件放到系統盤的 windows/system32 文件夾裡就可以瞭

現在說下ADB常用的幾個命令
查看設備

* adb devices

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

* adb install <apk文件路徑>

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

卸載軟件

* adb uninstall <軟件名>
* adb uninstall -k <軟件名>

如果加 -k 參數,為卸載軟件但是保留配置和緩存文件.
登錄設備shell

* adb shell
* adb shell <command命令>

這個命令將登錄設備的shell.
後面加<command命令>將是直接運行設備命令, 相當於執行遠程命令
從電腦上發送文件到設備

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

用push命令可以把本機電腦上的文件或者文件夾復制到設備(手機)
從設備上下載文件到電腦

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

用pull命令可以把設備(手機)上的文件或者文件夾復制到本機電腦
顯示幫助信息

* adb help

這個命令將顯示幫助信息

這裡還有一個英文版的:

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

adb devices – 列出連接到電腦的ADB設備(也就是手機),一般顯示出手機P/N碼.如果沒有顯示出來則手機與電腦沒有連接上.
adb install <packagename.apk> – 安裝手機軟件到手機中,如:adb install qq2009.apk.
adb remount – 重新打開手機寫模式(刷機模式).
adb push <localfile> <location on your phone> – 傳送文件到手機中,如:adb push recovery.img /sdcard/recovery.img,將本地目錄中的recovery.img文件傳送手機的SD卡中並取同樣的文件名.
adb pull <location on your phone> <localfile> – 傳送手機的文件到本地目錄(和上命令相反).

adb shell <command> – 讓手機執行命令,<command>就是手機執行的命令.如: 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 <serial number>            – directs command to the USB device or emulator withthe given serial number
-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.
devices   – list all connected 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 (see ‘adb help all’)
adb shell                    – run remote shell interactively
adb shell <command>          – run remote shell command
adb emu <command>            – run emulator console command
adb logcat [ <filter-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 socket 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] <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)
adb uninstall [-k] <package> – 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: <serial-number>
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 <tty> [parameters]   – Run PPP over USB.
Note: you should not automatically start a PDP 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

Leave a Reply

Your email address will not be published. Required fields are marked *