启动appium server 端口为5037
adb.exe -P 5037 start-server’
获取ro.build.version.sdk的版本号
adb.exe -P 5037 -s 127.0.0.1:7555 shell getprop ro.build.version.sdk
等待手机端响应
adb.exe -P 5037 -s 127.0.0.1:7555 wait-for-device
执行ping命令检查和手机通讯是否正常
adb.exe -P 5037 -s 127.0.0.1:7555 shell echo ping
检查io.appium.settings是否安装,并且判断版本是否符合要求
adb.exe -P 5037 -s 127.0.0.1:7555 shell dumpsys package io.appium.settings
adb.exe -P 5037 -s 127.0.0.1:7555 shell dumpsys package io.appium.settings
检查pgrep命令是否可用
adb.exe -P 5037 -s 127.0.0.1:7555 shell ‘pgrep --help; echo $?’
获取io.appium.settings进程号,判断io.appium.settings经常是否运行
adb.exe -P 5037 -s 127.0.0.1:7555 shell pgrep -f ([[:blank:]]|^)io.appium.settings([[:blank:]]|$)
appops命令设置io.appium.settings包的android:mock_location模式为allow
adb.exe -P 5037 -s 127.0.0.1:7555 shell appops set io.appium.settings android:mock_location allow
logcat日志
adb.exe -P 5037 -s 127.0.0.1:7555 logcat -v threadtime
端口反向代理
adb.exe -P 5037 -s 127.0.0.1:7555 forward tcp:8210 tcp:6790
获取 io.appium.uiautomator2.server的版本并校验签名
adb.exe -P 5037 -s 127.0.0.1:7555 shell dumpsys package io.appium.uiautomator2.server
获取io.appium.uiautomator2.server.test包的版本并校验签名
adb.exe -P 5037 -s 127.0.0.1:7555 shell dumpsys package io.appium.uiautomator2.server.test
检测com.github.uiautomator.test/androidx.test.runner.AndroidJUnitRunner是否可用
adb.exe -P 5037 -s 127.0.0.1:7555 shell pm list instrumentation
关闭session
adb.exe -P 5037 -s 127.0.0.1:7555 shell am force-stop io.appium.uiautomator2.server.test
adb.exe -P 5037 -s 127.0.0.1:7555 shell dumpsys window
adb.exe -P 5037 -s 127.0.0.1:7555 forward --remove tcp:8210