折腾:
【未解决】给安卓手机ViVo的iQOO U1x初始化uiautomator2自动化测试环境
插到Mac上,然后没有弹框,自己看了系统通知是有USB相关选项:
然后自己手动点击了 管理文件:

估计 管理文件 属于 MTP模式?
然后先要去开启开发者模式:
【已解决】给安卓手机ViVo的iQOO U1x开启开发者模式和打开USB调试
然后去初始化安卓手机
1 2 3 | ~ adb devices List of devices attached 2e2a0cb1 device |
确认adb可以检测到安卓设备,id是:2e2a0cb1
期间,先去安装ATX相关的apk,初始化调试环境
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | [ 201207 15 : 30 : 31 ][DevicesMethods.py 1836 ] start to launch device 2e2a0cb1 [ 201207 15 : 30 : 34 ][DevicesMethods.py 1945 ] start to unlock device 2e2a0cb1 err = Command 'adb -s 2e2a0cb1 shell dumpsys window policy | grep mScreenOnFully' returned non - zero exit status 1. when run cmd = adb - s 2e2a0cb1 shell dumpsys window policy | grep mScreenOnFully [ 201207 15 : 30 : 38 ][DevicesMethods.py 88 ] start init driver [W 201207 15 : 30 : 38 __init__: 203 ] atx - agent has something wrong, auto recovering [D 201207 15 : 30 : 38 __init__: 287 ] device 2e2a0cb1 is online [I 201207 15 : 30 : 39 init: 155 ] uiautomator2 version: 2.12 . 0 [I 201207 15 : 30 : 39 init: 352 ] Install minicap, minitouch [I 201207 15 : 30 : 39 init: 365 ] Install com.github.uiautomator, com.github.uiautomator.test 2.3 . 1 [I 201207 15 : 31 : 11 init: 332 ] - app - uiautomator.apk installed [I 201207 15 : 31 : 12 init: 332 ] - app - uiautomator - test.apk installed [I 201207 15 : 31 : 12 init: 340 ] Install atx - agent 0.9 . 5 [I 201207 15 : 31 : 12 init: 377 ] Check atx - agent version [ 201207 15 : 31 : 12 ][api.py 40 ] ( 'Connection aborted.' , RemoteDisconnected( 'Remote end closed connection without response' )), retrying in 0.5 seconds... Successfully init AdbDevice(serial = 2e2a0cb1 ) [ 201207 15 : 31 : 13 ][DevicesMethods.py 4405 ] screenX = 720 , screenY = 1600 , statusBarHeight = 56 , contentMaxY = 1459 [ 201207 15 : 31 : 13 ][DevicesMethods.py 4425 ] X = 720 , Y = 1459 , totalY = 1600 , topY = 56 [ 201207 15 : 31 : 13 ][DevicesMethods.py 4426 ] SwipeLeft = [ 648 , 729 , 72 , 729 ], VisibleBoundsHasHead = [ 0 , 56 , 720 , 1459 ], BackImageGivenBounds = [ 0 , 56 , 129 , 218 ], BottomBounds = [ 0 , 1313 , 720 , 1459 ], MiddleBounds = [ 0 , 56 , 720 , 1313 ] [ 201207 15 : 31 : 13 ][DevicesMethods.py 4629 ] SwipeUp:[ 500 , 100 , 500 , 1213 ], SwipeDown:[ 500 , 1213 , 500 , 100 ] [ 201207 15 : 31 : 13 ][DevicesMethods.py 4630 ] X * Y: 720 * 1459 ,topY: 56 ,headY: 0 ,totalY: 1600 ,Bottom: 1313 - 1459 [ 201207 15 : 31 : 13 ][DevicesMethods.py 1967 ] there is 100 % electricity |
开始抓包了。
但是:
【未解决】安卓手机Vivo的iQOO U1x自动安装appk时弹框提示:电脑端位置来源试图安装,为防止恶意安装程序,需要您验证身份后安装
目前无法解决,只能手动输入密码了。。。
重测,输入密码
1 2 3 4 5 6 7 8 9 10 11 12 | 。。。 Performing Streamed Install [D 201207 16 : 11 : 20 __init__: 600 ] kill process(ps): uiautomator [D 201207 16 : 11 : 21 init: 59 ] Use cached assets: / Users / xxx / .uiautomator2 / cache / app - uiautomator.apk - 81d5349503 / app - uiautomator.apk [D 201207 16 : 11 : 21 __init__: 348 ] pm install / data / local / tmp / app - uiautomator.apk [D 201207 16 : 11 : 44 init: 59 ] Use cached assets: / Users / xxx / .uiautomator2 / cache / app - uiautomator - test.apk - a0b8958cc1 / app - uiautomator - test.apk [D 201207 16 : 11 : 44 __init__: 348 ] pm install / data / local / tmp / app - uiautomator - test.apk [D 201207 16 : 11 : 52 __init__: 618 ] uiautomator - v2 is starting ... left: 40.0s [D 201207 16 : 11 : 53 __init__: 618 ] uiautomator - v2 is starting ... left: 38.9s [D 201207 16 : 11 : 54 __init__: 618 ] uiautomator - v2 is starting ... left: 37.9s [D 201207 16 : 11 : 55 __init__: 618 ] uiautomator - v2 is starting ... left: 36.8s [I 201207 16 : 11 : 55 __init__: 583 ] uiautomator back to normal |
手机端,可以弹框输入密码后,继续安装:

vivo 安装来源
vivo正为您云端检测风险
ATX

外部来源应用,未经vivo安全性和兼容性检测,请谨慎安装。
不过好消息是紧接着的apk的安装:
com.github.uiautomator.test

无需再次弹框和输入密码了。
看来至少是 已输入密码后,短期内再安装apk,则无需再次输入。
以及代码自动检测并点击了 继续安装:
完整log
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | [ 201207 16 : 11 : 18 ][AppCrawler.py 77 ] start to crawl app 0 com.netease.my.vivo_梦幻西游 com.netease.my.vivo, remain 10 [ 201207 16 : 11 : 18 ][DevicesMethods.py 4064 ] start to install app in 20201207_fengyun_ViVoGameMoYuFirstTen_gameApp_Android .txt [ 201207 16 : 11 : 18 ][DevicesMethods.py 4112 ] Run length = 244 , command: adb - s 2e2a0cb1 install - r - f / Users / xxx / dev / xxx / crawler / appAutoCrawler / AppCrawler / task / 20201207_fengyun_ViVoGameMoYuFirstTen / 20201207_fengyun_ViVoGameMoYuFirstTen_gameApp_Android / 20201207_fengyun_ViVoGameMoYuFirstTen_gameApp_Android_0 .apk Performing Streamed Install [D 201207 16 : 11 : 20 __init__: 600 ] kill process(ps): uiautomator [D 201207 16 : 11 : 21 init: 59 ] Use cached assets: / Users / xxx / .uiautomator2 / cache / app - uiautomator.apk - 81d5349503 / app - uiautomator.apk [D 201207 16 : 11 : 21 __init__: 348 ] pm install / data / local / tmp / app - uiautomator.apk [D 201207 16 : 11 : 44 init: 59 ] Use cached assets: / Users / xxx / .uiautomator2 / cache / app - uiautomator - test.apk - a0b8958cc1 / app - uiautomator - test.apk [D 201207 16 : 11 : 44 __init__: 348 ] pm install / data / local / tmp / app - uiautomator - test.apk [D 201207 16 : 11 : 52 __init__: 618 ] uiautomator - v2 is starting ... left: 40.0s [D 201207 16 : 11 : 53 __init__: 618 ] uiautomator - v2 is starting ... left: 38.9s [D 201207 16 : 11 : 54 __init__: 618 ] uiautomator - v2 is starting ... left: 37.9s [D 201207 16 : 11 : 55 __init__: 618 ] uiautomator - v2 is starting ... left: 36.8s [I 201207 16 : 11 : 55 __init__: 583 ] uiautomator back to normal [I 201207 16 : 12 : 22 watcher: 255 ] XPath(hook:继续安装): [ '继续安装' ] Success [ 201207 16 : 12 : 31 ][AppCrawler.py 110 ] crawl com.netease.my.vivo / 梦幻西游 start [W 201207 16 : 12 : 31 watcher: 181 ] already started [ 201207 16 : 12 : 31 ][DevicesMethods.py 151 ] start com.netease.my.vivo |
此处可以接着继续调试了。
且首次游戏时还有有加速工具启动:


【后记】
都忘了,需要去初始化代理环境了:
【已解决】给安卓手机Vivo的iQOO U1x初始化mitmdump的代理环境
以及还要再去确认:
是否所有的之前的命令,尤其是adb,都是指定了设备
即
1 | adb -s android_device_id |
否则就容易无法识别当前具体操作哪个安卓设备了。
试了多次,重新拔插USB转接头后,终于可以识别2个安卓了:
1 2 3 4 | ~ adb devices List of devices attached 2e2a0cb1 device hmucaei75ptk7szs device |
然后再去确认代码
搜:
1 | adb |
去看看

查看了所有的adb,都是带-s指定设备的。所以没问题。
那就可以继续调试了,不用担心adb混淆误操作设备了。