ADB Android 調試器 下載器

來源:互聯網
上載者:User


   adb是一個萬能的工具,讓你可以管理android裝置的狀態,更多關於adb的資訊可以參考:http://developer.android. com/guide/developing/tools/adb.html.

ADB大概有以下用途:

  1. 在主機上下載安裝apk應用程式,在目標裝置上啟動運行;
  2. 在主機上啟動目標裝置的shell;
  3. 使用DDMS(Dalvik Debug Monitor Server,運行在ADB的上層)工具調試運行在裝置的應用程式;
  4. 主機和裝置之間拷貝檔案;

下載“ADB”和安裝配置主機(Ubuntu-12.04)

  adb是android SDK包的一部分,在這個地方可以找到:http://developer.android.com/sdk/index.html,按照串連裡的步驟安裝完Android SDK後,接著執行下面命令配置環境變數:

$ export PATH=<android_sdk_path>/platform-tools/:<android_sdk_path>/tools/:$PATH

通過adb串連主機和裝置,有以下三種方式:

  1. 通過USB
  2. 通過網路

通過USB

  首先確保主機與裝置的usb串連,然後裝置裡的開發人員選項,開啟usb調試

以管理員權限建立/etc/udev/rules.d/51-android.rules檔案,讓主機能夠檢測到裝置,在檔案中添加裝置ID,如:18d1,如果是usb裝置可以用lsusb命令看到當前串連主機usb裝置的ID

SUBSYSTEM=="usb", SYSFS{idVendor}=="18d1", MODE="0666"

儲存退出。

執行下面命令:

$ chmod a+r /etc/udev/rules.d/51-android.rules

註:建議改變上面配置後重啟主機系統。

最後adb devices察看是否有串連的裝置,如果串連上了,例如:

List of devices attached

20100720

device

通過網路-乙太網路

確保主機和裝置乙太網路已經開啟;

查看裝置網路設定:

# netcfg

lo UP 127.0.0.1/8 0x00000049 00:00:00:00:00:00

sit0 DOWN 0.0.0.0/0 0x00000080 00:00:00:00:00:00

eth0 UP 192.168.0.100/22 0x00001043 96:cd:df:8b:c6:2b

通過setprop配置裝置機器的adb Daemon:

# setprop service.adb.tcp.port 5555

如果通過上面的步驟,網路設定成功,可以執行一下命令重啟目標板的adb服務:

# stop adbd

# start adbd

在主機端執行下面命令建立adb串連:

$ export ADBHOST=<target's ip address>

$ adb kill-server

$ adb start-server

$ adb connect <target_ip_address>:5555

執行以下命令查看是否連上:

$ adb devices

如果串連上了,就會有裝置列表:

List of devices attached

172.24.191.26:5555    device

啟動目標板的shell

$ adb shell

 

adb Windows PC下通過USB 串連

大體步驟如下:

  1. 下載最新Android SDK
  2. 配置環境變數
  3. 下載Android USB 驅動(https://dl-ssl.google.com/android/repository/usb_driver_r03-windows.zip) 解壓到(i.e. c:\android_sdk\usb_driver)
  4. 修改(或建立檔案)"%USERPROFILE%\.android\adb_usb.ini":

    > echo 0x18D1 > "%USERPROFILE%\.android\adb_usb.ini"
  5. 修改 android_winusb.inf 檔案配置EVM/Beagle vendor and product ids:

    在[Google.NTx86]段下添加:

    ;TI EVM

    %SingleAdbInterface%  = USB_Install, USB\VID_18D1&PID_9018

    %CompositeAdbInterface%  = USB_Install, USB\VID_18D1&PID_9018&MI_01

     如果是amd64位,就在Google.NTamd64段下加。

  6. 串連usb啟動裝置;

  7. 如果正常的話Windows會提示安裝裝置驅動;

Answer "No, not this time" to the question about running Windows Update to search for software.

• Choose "Install the hardware that I manually select from a list (Advanced)" this is the 2nd option, then click

"Next"

• Select "Show All Devices", then click "Next"

• You are going to see a grayed-out text box with "(Retrieving a list of all devices)", click the "Have Disk..."

button

• Browse" to your driver folder (c:\android_sdk\usb_driver). It will be looking of a .inf file so select

"android_winusb.inf" and click "Open" then "OK". It's the only file there so you shouldn't go wrong.

• Select "Android ADB Interface" then click the "Next" button.

• A warning will appear, answer "Yes" but read the warning anyway.

• Click the "Close" when the wizard is completed.

8. 正常設定完畢後,

> adb kill-server

> adb start-server

下來就可以使用命令了。

基本操作裝置名稱令:

1. 安裝apk

$ adb install <package>.apk

要安裝到外部裝置的話加-s

2. 卸載apk

方法一:

adb shell pm list packages

adb uninstall <package name>

方法二:

進入設定-應用程式下卸載

卸載系統內建預設的程式:

$adb shell

# rm /system/app/app.apk

3.主機和裝置之間拷貝檔案

adb push <local> <remote>

adb pull <remote> <local>

 

參考:TI Devkit userguide 文檔

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.