adb 无法统计 APK:没有这样的文件或目录

发布于 2025-01-10 19:28:51 字数 1122 浏览 1 评论 0原文

我是 MacOS 用户,我正在尝试访问应用程序中的特定活动(该应用程序是 APK 文件)。我从 Android Studio 运行的模拟器是 Pixel 3a XL。我有一个连接到 Appium 服务器的 Python 客户端。我使用 Appium GUI 服务器来运行代码并使用 PyCharm 来编写代码。在运行 Appium GUI 服务器、Android 模拟器和 PyCharm 代码之前,我使用了不同的 APK 文件,然后切换到新的文件。我输入命令“appium-doctor --android”来验证我的环境变量和 adb 路径是否正确,并且有复选标记表明它是正确的。在我的 PyCharm 测试失败后,我使用终端安装模拟器并收到一个新错误,指出没有这样的文件或目录,即使我的 APK 路径是正确的。

Python代码:

从appium导入webdriver

所需的能力= { "设备名称": "Pixel_3a_XL", "appPackage": "edu.psu.hhd.hdfs.jpm165.genericsurveyapp2", "appActivity": ".SplashScreenActivity", “平台名称”:“Android”, “应用程序”:“/Users/jkenglish/Desktop/Surge_Projects/app-debug-signed-2-22-22.apk” }

#驱动程序实例

webdriver.Remote("http://localhost:4723/wd/hub",desired_capability)

终端命令:

adb -s emulator-5554 install /Users/jkenglish/Desktop/Surge_Projects/app-debug-signed-2-22-2022.apk

执行流式安装 adb:无法统计 /Users/jkenglish/Desktop/Surge_Projects/app-debug-signed-2-22-2022.apk:没有这样的文件或目录

I am a MacOS user, and I am trying to access a specific activity within an app (the app is the APK file). The emulator I am running from Android Studio is Pixel 3a XL. I have a Python client connected to the Appium server. I am using the Appium GUI server to run the code and using PyCharm to write the code. Prior to running the Appium GUI server, Android emulator, and PyCharm code, I was using a different APK file then switched to a new one. I typed in the command, 'appium-doctor --android' to verify that my environment variables and adb path is correct and there were checkmarks indicating that it was. After my PyCharm test failed, I used the terminal to install the emulator and received a new error stating that there is no such file or directory even though my path to my APK is correct.

Python Code:

from appium import webdriver

desired_capabilities = {
"deviceName": "Pixel_3a_XL",
"appPackage": "edu.psu.hhd.hdfs.jpm165.genericsurveyapp2",
"appActivity": ".SplashScreenActivity",
"platformName": "Android",
"app":"/Users/jkenglish/Desktop/Surge_Projects/app-debug-signed-2-22-22.apk"
}

#Driver Instance

webdriver.Remote("http://localhost:4723/wd/hub", desired_capabilities)

Terminal Command:

adb -s emulator-5554 install /Users/jkenglish/Desktop/Surge_Projects/app-debug-signed-2-22-2022.apk

Performing Streamed Install
adb: failed to stat /Users/jkenglish/Desktop/Surge_Projects/app-debug-signed-2-22-2022.apk: No such file or directory

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

诗化ㄋ丶相逢 2025-01-17 19:28:51

看来该文件不存在。

运行这些

f='/Users/jkenglish/Desktop/Surge_Projects/app-debug-signed-2-22-2022.apk'
if [[ -e "$f" ]]
then
    adb -s emulator-5554 install "$f"
else
    printf 'ERROR: %s does not exist\n' "$f"
fi

It seems the file does not exist.

Run these

f='/Users/jkenglish/Desktop/Surge_Projects/app-debug-signed-2-22-2022.apk'
if [[ -e "$f" ]]
then
    adb -s emulator-5554 install "$f"
else
    printf 'ERROR: %s does not exist\n' "$f"
fi
提笔书几行 2025-01-17 19:28:51

做一些简单的检查

  • 文件是否存在于指定位置(您已经确认了这一点)

  • 文件目录路径写入正确

  • 如果文件路径包含特殊字符,请在路径两边使用引号

  • 如果通过环境变量引用时 adb 不起作用,请尝试使用 adb 的完整路径。如果 adb 目录路径还包含空格或特殊字符,请在此处的路径周围使用引号

Do some simple checks

  • If the file exists in the specified location (you've confirmed this already)

  • The file directory path is correctly written

  • If the file path contains special characters, use quotes around the path

  • If adb is not working when referenced via environment variable try using the full path of adb. If the adb directory paths also contains spaces or special characters, use quotes around the path here also

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文