首先通过如下命令找到appium的安装路径
C:\Users\Shuqing>where appium
C:\Users\Shuqing\AppData\Roaming\npm\appium
C:\Users\Shuqing\AppData\Roaming\npm\appium.cmd
1.打开 C:\Users\Shuqing\AppData\Roaming\npm\node_modules\appium\node_modules\appium-android-driver\lib 中的android-helpers.js
#注释475行如下代码
//await helpers.pushSettingsApp(adb);
#注释486行如下代码
//await helpers.pushUnlock(adb);
//注释安装io.appium.settings/.UnicodeIME
//await adb.install(unicodeIMEPath, {replace: false});
2.打开C:\Users\Shuqing\AppData\Roaming\npm\node_modules\appium\node_modules\appium-android-driver\build\lib中的android-helpers.js
#注释1128行下面这行代码
//return _regeneratorRuntime.awrap(helpers.pushSettingsApp(adb));
#修改为如下:
return context$1$0.abrupt('return', defaultIME);
#注释1163行下面这行代码
//return _regeneratorRuntime.awrap(helpers.pushUnlock(adb));
#修改如下:
return context$1$0.abrupt('return', defaultIME);
//return _regeneratorRuntime.awrap(helpers.initUnicodeKeyboard(adb));
return context$1$0.abrupt('return', defaultIME);
修改完成后重启Appium服务即可,如果新设备没有这个两个守护App可以手动安装这两个App到设备。
Appium Setting路径 :
{appium安装路径}\node_modules\_io.appium.settings@2.4.0@io.appium.settings\app\build\outputs\apk\settings_apk-debug.apk
eg:
C:\Users\Shuqing\AppData\Roaming\npm\node_modules\appium\node_modules\_io.appium.settings@2.4.0@io.appium.settings\app\build\outputs\apk\settings_apk-debug.apk
Unlock app路径:
appium安装路径\node_modules\_appium-unlock@2.0.0@appium-unlock\bin \unlock_apk-debug.apk
eg:
C:\Users\Shuqing\AppData\Roaming\npm\node_modules\appium\node_modules\_io.appium.settings@2.4.0@io.appium.settings\app\build\outputs\apk\unlock_apk-debug.apk