使用appium 在真机上测试时,出现如下错误: 

[debug] Error: Command failed: C:\WINDOWS\system32\cmd.exe /s /c "D:\android-sdk-windows\tools\adb.exe -s AKC7N18420012455 install "D:\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk""
adb: failed to install D:\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk: Failure [INSTALL_FAILED_ALREADY_EXISTS: Attempt to re-install io.appium.settings without first uninstalling.]

Error: Command failed: C:\WINDOWS\system32\cmd.exe /s /c "D:\android-sdk-windows\tools\adb.exe -s AK

原因分析:

使用appium在执行app自动化测试时,是会在手机上安装2个应用程序的。分别是:AppiumSettings和Unlock 

Error: Command failed: C:\WINDOWS\system32\cmd.exe /s /c "D:\android-sdk-windows\tools\adb.exe -s AK

这2个应用程序就是上面提示中的 settings_apk-debug.apk 和 unlock_apk-debug.apk

Error: Command failed: C:\WINDOWS\system32\cmd.exe /s /c "D:\android-sdk-windows\tools\adb.exe -s AK

Error: Command failed: C:\WINDOWS\system32\cmd.exe /s /c "D:\android-sdk-windows\tools\adb.exe -s AK

Error: Command failed: C:\WINDOWS\system32\cmd.exe /s /c "D:\android-sdk-windows\tools\adb.exe -s AK


在手机上看的见的是这2个,实际上还会安装一个 UnicodeIME-debug.apk

Error: Command failed: C:\WINDOWS\system32\cmd.exe /s /c "D:\android-sdk-windows\tools\adb.exe -s AK

Error: Command failed: C:\WINDOWS\system32\cmd.exe /s /c "D:\android-sdk-windows\tools\adb.exe -s AK

我们在使用真机去跑自动化的时候是需要先卸载这3个apk ,实际上我们只卸载了前2个,而漏掉了后面这个。

我们使用adb命令:

adb shell pm list package -3 查出所有的第三方安装包:

Error: Command failed: C:\WINDOWS\system32\cmd.exe /s /c "D:\android-sdk-windows\tools\adb.exe -s AK

可以看到这样的包名:

package:io.appium.android.ime

解决方法:

卸载这个3个包。可以选择通过命令的方法,也可以直接卸载,但是直接卸载的话手机上只能卸载其中2个,所以会导致卸载不干净。

Error: Command failed: C:\WINDOWS\system32\cmd.exe /s /c "D:\android-sdk-windows\tools\adb.exe -s AK


相关文章:

  • 2021-12-26
  • 2021-11-25
  • 2021-06-15
  • 2021-10-05
  • 2021-08-01
  • 2022-12-23
  • 2021-11-06
  • 2021-07-06
猜你喜欢
  • 2022-12-23
  • 2021-07-28
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-23
相关资源
相似解决方案