- 一天笑嘻嘻是一名測試人員琴昆,想了解Android的測試方法,于是璧坟,就找到了小測試既穆。
- 笑嘻嘻:身為一名測試人員需要了解ADB的哪些內(nèi)容?
- 小測試:了解原理和簡單的命令使用就可以了雀鹃。
- 笑嘻嘻:你有毒啊幻工,都了解原理了,還簡單實用黎茎?
- 小測試:用工具不疑会钝,疑工具不用,知道這個工具怎么運行的用起來才得心應(yīng)手啊工三。另外ADB命令就像Linux的命令一樣迁酸,記住常用的,了解大部分的俭正,遇到問題知道百度什么就好奸鬓。
ADB介紹
- ADB即Android Debug Bridge,是Android提供的一個通用的調(diào)試工具,是一個C/S架構(gòu)的命令掸读,用這個工具可以直接操作管理android模擬器或者真實的android設(shè)備串远。
- ADB是一個客戶端/服務(wù)器架構(gòu)的命令行工具,主要由3個部分組成儿惫。
image- Adb clent(客戶端):可以通過它對Android應(yīng)用進行安裝澡罚、卸載及調(diào)試。
- adb service(服務(wù)器):管理客戶端到Android設(shè)備上abd后臺進程的連接肾请。
- adb daemon(守護進程):運行在Android設(shè)備上的adb后臺進程留搔。
ADB安裝
安裝方法大同小異,很多文章都推薦安裝Android sdk铛铁,其實adb工具是包含在Android sdk平臺工具軟件包里的一個隔显,我們把adb下載了就好。舉個例子:王者榮耀是應(yīng)用寶的一個應(yīng)用饵逐,如果我們要玩王者榮耀括眠,需要把所有的應(yīng)用都下載了么?當(dāng)然不需要倍权。
image
下載鏈接
獲取platform-tools和tools的文件路徑
獲得到上面的安裝包或者安裝好Android SDK之后掷豺,找到:platform-tools文件夾(復(fù)制路徑)
image
添加環(huán)境變量
由于我們的adb命令是在cmd環(huán)境下使用,所有要添加環(huán)境變量
- 右鍵點擊此電腦
- 高級系統(tǒng)設(shè)置
- 高級
- 環(huán)境變量
-
系統(tǒng)變量(建議是系統(tǒng)變量)
image - 點擊編輯
- 新建
- 把platform-tools和tools(tools在platform-tools下面)的路徑添加進來薄声。
- 打開cmd環(huán)境当船,輸入adb,回車奸柬,如果有出現(xiàn)下面的生年,恭喜你,安裝成功@取1瘛档叔!
C:\Users\wy.DESKTOP-KENPKKP>adb
Android Debug Bridge version 1.0.36
Revision 0e9850346394-android
-a - directs adb to listen on all interfaces for a connection
-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 <specific device> - directs command to the device or emulator with the given
serial number or qualifier. 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 not specified, the ANDROID_PRODUCT_OUT
environment variable is used, which must
be an absolute path.
-H - Name of adb server host (default: localhost)
-P - Port of adb server (default: 5037)
devices [-l] - list all connected devices
('-l' will also list device qualifiers)
connect <host>[:<port>] - connect to a device via TCP/IP
Port 5555 is used by default if no port number is specified.
disconnect [<host>[:<port>]] - disconnect from a TCP/IP device.
Port 5555 is used by default if no port number is specified.
Using this command with no additional arguments
will disconnect from all connected TCP/IP devices.
今天就先到這里,如果有問題的請留言指正蒸绩。