如何解决使用 Appium 测试 Android 应用时出现的错误“appium-uiautomator2-server-debug-androidTest.apk'不存在或不可访问”?

Posted

技术标签:

【中文标题】如何解决使用 Appium 测试 Android 应用时出现的错误“appium-uiautomator2-server-debug-androidTest.apk\'不存在或不可访问”?【英文标题】:How to solve the error "appium-uiautomator2-server-debug-androidTest.apk' does not exist or is not accessible" in testing an Android app using Appium?如何解决使用 Appium 测试 Android 应用时出现的错误“appium-uiautomator2-server-debug-androidTest.apk'不存在或不可访问”? 【发布时间】:2020-06-13 04:58:15 【问题描述】:

我正在使用带有 UiAutomator2 的 Appium 测试一个 android 应用程序。我想我已经正确设置了一切。

但是,当我使用“node index.js”命令运行 index.js 时,我在控制台输出中收到以下错误消息:

由于处理命令时发生未知的服务器端错误,请求失败。原始错误:'/home/heyn/.nvm/versions/node/v12.16.1/lib/node_modules/appium/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-debug-androidTest.apk 中的文件' 不存在或不可访问

完整的控制台输出:

https://gist.github.com/HeynSekk/e5fc76dc7d975569f8d18d54dcd00974

完整的服务器日志输出如下:

https://gist.github.com/HeynSekk/fb03a762d65b0366f2849af52ab5046a

我该如何解决这个错误?

环境

-Ubuntu 18.04 LTS

-Appium v​​1.16.0

-自动化:UiAutomator2

【问题讨论】:

嘿,你解决问题了吗?怎么样? 【参考方案1】:

你的错误很清楚,它说路径home/heyn/.nvm/versions/node/v12.16.1/lib/node_modules/appium/node_modules/appium-uiautomator2-server/apks/中没有这样的文件(appium-uiautomator2-server-debug-androidTest.apk)。您需要为您的应用程序提供正确的路径以启动 appium 服务器。

【讨论】:

以上是关于如何解决使用 Appium 测试 Android 应用时出现的错误“appium-uiautomator2-server-debug-androidTest.apk'不存在或不可访问”?的主要内容,如果未能解决你的问题,请参考以下文章

在移动原生应用程序测试中:使用 Appium 时如何模拟后端?

如何使用 Appium 滚动 Robot Framework 以在 Android 设备上测试应用程序

使用appium在android7.0真机上测试程序时报错command failed shell “ps ‘uiautomator’”的解决方式

使用appium在android7.0真机上测试程序时报错command failed shell “ps ‘uiautomator’”的解决方式

android自动化测试--appium运行的坑问题及解决方法

彻底解决appium 自动化测试时总是自动安装appium android input manager for unicode