登录 主页

在实体手机上,保证手机能够正常运行uiautomator2,并安装ATX-agent

2025-09-13 08:25PM

以小米手机为例,首先打开 设置 -> 更多设置 -> 开启开发者模式

 

使用adb命令,查看设备是否连通

$ adb devices

如果显示这个,就表示链接成功

root@DESKTOP-8TI8PSU:~# adb devices
List of devices attached
fa52d0c7        device

使用这个命令,对设备进行初始化

 $ python -m uiautomator2 init

会输出下面的内容

# python -m uiautomator2 init
[D 2025-09-13 18:01:05,506 core:254 pid:15680] file u2.jar md5: 3564c56e4ef077f92c0fd32bcb42aea1
[D 2025-09-13 18:01:05,603 core:243 pid:15680] file u2.jar already pushed
[D 2025-09-13 18:01:05,603 core:111 pid:15680] http request GET /ping None
[D 2025-09-13 18:01:05,645 core:254 pid:15680] file u2.jar md5: 3564c56e4ef077f92c0fd32bcb42aea1
[D 2025-09-13 18:01:05,725 core:243 pid:15680] file u2.jar already pushed
[D 2025-09-13 18:01:05,726 _input:71 pid:15680] installing AdbKeyboard ime
apkutils is not installed, install it with 'pip install adbutils[apk]'
push apk to device: /data/local/tmp/unknown.apk
100.0%  23.9 MB/s [1.8 MB/1.8 MB]
100.0%  0.0 MB/s [1.8 MB/1.8 MB]
install to android system ...
successfully installed, time used 10.4 seconds
[D 2025-09-13 18:01:16,234 base:110 pid:15680] shell: ime list -s -a
[D 2025-09-13 18:01:16,612 base:110 pid:15680] shell: ime list -s -a
[D 2025-09-13 18:01:16,994 base:110 pid:15680] shell: ime list -s -a 

然后手机会提示要安装 ATX,点击继续安装,就可以了

 

返回>>

登录

请登录后再发表评论。

评论列表:

目前还没有人发表评论