鸿蒙4.0.0 安装minitouch
ubuntu 系统
minitouch 地址 https://github.com/DeviceFarmer/minitouch
因为 鸿蒙4.0.0 对应安卓12 API版本31
所以启动 minitouch 需要 STFService
地址 https://github.com/openstf/STFService.apk
到release下载最新的STFService.apk
(或者自己源码编译,需要安装安卓studio )
adb install STFService.apk
1安装成功后启动 server
adb shell am start-foreground-service --user 0 -a jp.co.cyberagent.stf.ACTION_START -n jp.co.cyberagent.stf/.Service
官方以下这条命令不对,别用
adb shell am startservice --user 0 \
-a jp.co.cyberagent.stf.ACTION_START \
-n jp.co.cyberagent.stf/.Service
会报错 Error: app is in background uid null
2 创建server端口转发
adb forward tcp:1100 localabstract:stfservice
本地端口1100连接
nc localhost 1100
3 新建终端 运行 agent
在新的终端 输入命令:
路径变量
APK=$(adb shell pm path jp.co.cyberagent.stf | \
tr -d '\r' | awk -F: '{print $2}')
运行
adb shell export CLASSPATH="$APK"\; \
exec app_process /system/bin jp.co.cyberagent.stf.Agent
4 创建agent 端口转发
新建终端输入命令:
adb forward tcp:1090 localabstract:stfagent
本地端口1090连接
nc localhost 1090
5 运行minitouch
新建终端
我已经提前安装好minitouch 到手机目录 /data/local/tmp/
输入 adb shell /data/local/tmp/minitouch
打印如下:
wmx:~$ adb shell /data/local/tmp/minitouch
open: Permission denied
Unable to open device /dev/input/event2 for inspectionopen: Permission denied
Unable to open device /dev/input/event0 for inspectionopen: Permission denied
Unable to open device /dev/input/event3 for inspectionopen: Permission denied
Unable to open device /dev/input/event1 for inspectionopen: Permission denied
Unable to open device /dev/input/event4 for inspectionopen: Permission denied
Unable to open device /dev/input/mouse0 for inspectionopen: Permission denied
Unable to open device /dev/input/mouse1 for inspectionopen: Permission denied
Unable to open device /dev/input/mice for inspectionopen: Permission denied
Unable to open device /dev/input/event6 for inspectionopen: Permission denied
Unable to open device /dev/input/event5 for inspectionopen: Permission denied
Unable to open device /dev/input/event7 for inspectionUnable to find a suitable touch device
using Android InputManager
新建终端创建minitouch 端口转发
adb forward tcp:1111 localabstract:minitouch
nc localhost 1111
显示
wmx:~$ nc localhost 1111
v 1
^ 10 1152 2376 0
$ 16385
成功!
运行命令测试
在手机 usb调试设置打开选项
-> 显示触摸操作
-> 指针位置
在步骤5命令 nc localhost 1111
创建的终端输入命令:
d 0 200 200 50 \n
c
看到效果