当前位置:网站首页>Appium automation test foundation ADB common commands (I)
Appium automation test foundation ADB common commands (I)
2022-06-28 02:10:00 【Test - Eight Precepts】
Use adb The premise of the command is to ensure that the mobile phone or simulator is connected to the computer .
Use adb connect 127.0.0.1:+ Port number command , Link .
1、 Startup and shutdown adb service
In some cases , You may need to terminate and then start the server process , for example ADB When you don't respond to commands , You can solve the problem by restarting .
Start the command line terminal and execute the command :
(1) start-up adb service ,adb command : adb start-server.
(2) close adb service ,adb command : adb kill-server.
demonstration :
- start-up adb service
C:\Users\L>adb start-server
* daemon not running; starting now at tcp:5037
* daemon started successfully
C:\Users\L> Tips : The daemon is not turned on , Now through 5037 Port open daemon service .
Be careful
- adb The default binding port of the command is 5037 , If the port is bound by another application, it cannot be started adb service .
- Generally, it is not necessary to execute this command manually , Running adb If you find
adb serverNo startup will automatically start up . - close adb service
close adb The service doesn't have any tips .

2、 see adb edition
adb command :adb version
C:\Users\L>adb version
Android Debug Bridge version 1.0.41
Version 29.0.6-6198805
Installed as F:\***\android-sdk-windows\platform-tools\adb.exe
C:\Users\L>3、 Appoint adb server The network port of
adb command :adb -P <port> start-server( Temporarily change a port number to open adb service )
The default port is 5037.
C:\Users\L>adb -P 5039 start-server
* daemon not running; starting now at tcp:5039
* daemon started successfully
C:\Users\L>Tips :
netstat -anoQuery process ID.taskkill /f /t /im Process nameKill the process .
Such as :taskkill /f /t /im nginx.exe
4、 Query connected devices / Simulator
adb command :adb devices
Premise :Android Simulator turned on .
demonstration :
(1) Direct execution adb devices command
C:\Users\L>adb devices
* daemon not running; starting now at tcp:5037
* daemon started successfully
List of devices attached
C:\Users\L> You can see from above , If we don't start adb service , And directly execute adb devices command , Will automatically help us turn on adb service , In execution adb devices command , As a result, no linked simulators were queried .
(2) Use adb Service link Android Simulator
Carry out orders adb connect 127.0.0.1:21503( notes : Different simulators have different port numbers ).
C:\Users\L> adb connect 127.0.0.1:21503
connected to 127.0.0.1:21503
C:\Users\L>(3) Re execution adb devices command , Query connected devices
C:\Users\L>adb devices
List of devices attached
127.0.0.1:21503 device
C:\Users\L> We can see adb The service has linked devices
explain :
The output format is [serialNumber] [state].
serialNumber That's what we call it SN code ,state There are the following :
offline—— Indicates that the device is not connected successfully or is not responding .device—— The device is connected . Note that this state does not identify Android The system is fully up and operational , During device startup, the device instance can be connected to adb, But the system can only be operated after startup .no device—— No equipment / Simulator connection .
Common abnormal output :
- No equipment / The simulator is connected successfully .
List of devices attached - equipment / Simulator is not connected to adb Or no response .
List of devices attached cf264b8f offline
5、 Get Android version
adb command :adb shell getprop ro.build.version.release
demonstration :
C:\Users\L>adb shell getprop ro.build.version.release
7.1.2
C:\Users\L>6、 Specify the target device for the command
If there are multiple devices / Simulator connection , You need to specify the target device for the command .
| Parameters | meaning |
|---|---|
| -d | Specifies the current unique pass USB Connected Android The device is the command target |
| -e | Specify the currently unique running simulator as the command target |
| -s <serialNumber> | Specify the corresponding serialNumber Equipment No / The simulator is the command target |
On multiple devices / When the simulator is connected, it is more commonly used to -s <serialNumber> Parameters ,serialNumber Can pass adb devices Command acquisition . Such as :
$ adb devices
List of devices attached
cf264b8f device
emulator-5554 device
10.129.164.6:5555 device In the output cf264b8f、emulator-5554 and 10.129.164.6:5555 That is to say serialNumber.
For example, I want to specify cf264b8f This device to run adb Command get screen resolution :
adb -s cf264b8f shell wm size
If you want to give 10.129.164.6:5555 This device installs applications ( In this form serialNumber The format is <IP>:<Port>, It's usually a wireless device or Genymotion Wait for the third party Android Simulator ):
adb -s 10.129.164.6:5555 install test.apk
Encounter multiple devices / The simulator uses these parameters to specify the target device for the command
a key : Supporting learning materials and video teaching
So here I have carefully prepared the detailed information of the above outline in The link below is as follows


边栏推荐
- TD Hero 线上发布会|7月2日邀你来
- 要搞清楚什么是同步,异步,串行,并行,并发,进程,线程,协程
- Evaluation - rank sum ratio comprehensive evaluation
- Adobe Premiere foundation - sound adjustment (volume correction, noise reduction, telephone tone, pitch shifter, parameter equalizer) (XVIII)
- Chapitre 4: redis
- Prometeus 2.35.0 new features
- 如何高效读书学习
- Appium自动化测试基础 — ADB常用命令(一)
- 205. 同构字符串
- Deep parsing of kubernetes controller runtime
猜你喜欢

Adobe Premiere基础-编辑素材文件常规操作(脱机文件,替换素材,素材标签和编组,素材启用,便捷调节不透明度,项目打包)(十七)
![[elt.zip] openharmony paper Club - memory compression for data intensive applications](/img/54/8248c1d95b04498d44a00ea94a6c85.png)
[elt.zip] openharmony paper Club - memory compression for data intensive applications

Jenkins - Pipeline 语法

Web3 technology initial experience and related learning materials

一张图弄懂 MIT,BSD,Apache几种开源协议之间的区别

How to optimize the "message" list of IM

Xctf attack and defense world misc wage earner advanced zone

Data analysts too hot? Monthly income 3W? Tell you the true situation of this industry with data

什麼是數字化?什麼是數字化轉型?為什麼企業選擇數字化轉型?

What is digitalization? What is digital transformation? Why do enterprises choose digital transformation?
随机推荐
COSCon'22 讲师征集令
766. toplitz matrix
基于可学习尺寸自适应分子亚结构的药物相互作用预测
How to study efficiently
如何高效读书学习
Neural network of zero basis multi map detailed map
frp实现内网穿透
Supervised, unsupervised and semi supervised learning
Import the data table in MySQL into Excel
[Yocto RM]9 - QA Error and Warning Messages
Adobe Premiere Basics - common video effects (corner positioning, mosaic, blur, sharpen, handwriting tools, effect control hierarchy) (16)
Adobe Premiere基础-常用的视频特效(裁剪,黑白,剪辑速度,镜像,镜头光晕)(十五)
Chapitre 4: redis
9. Openfeign service interface call
要搞清楚什么是同步,异步,串行,并行,并发,进程,线程,协程
Lmsoc: a socially sensitive pre training method
一张图弄懂 MIT,BSD,Apache几种开源协议之间的区别
【sylixos】i2c设备驱动创建和使用
评价——秩和比综合评价
Cesium 抗锯齿(线,边框等)