我正在使用Appium,ADB无法在三星设备上安装APK
这是我的代码:
@Test
public void testAppium() throws MalformedURLException{
//Capabilities
DesiredCapabilities capability = new DesiredCapabilities();
capability.setCapability("platformName", "Android");
// Nexus Device
//capability.setCapability("deviceName", "Nexus 5");
//capability.setCapability("platformVersion", "6.0.1");
//capability.setCapability("udid","RF8N21BNXHY");
// Galaxy S20
capability.setCapability("deviceName", "Galaxy S20");
capability.setCapability("platformVersion", "12");
capability.setCapability("udid","RF8N21BNXHY");
capability.setCapability("appWaitPackage", "abc");
capability.setCapability("appWaitActivity","abc");
File file = new File("C:\\Users\\ShahreenMushtaq\\new\\Test\\app-zameen-live-release
(1).apk");
capability.setCapability("app", file.getAbsolutePath());
相同的代码正在用于具有OS 6.0.1版本的Nexus设备,但不适用于三星设备。
错误:
错误:无法启动Appium会话,错误是:错误:命令失败:c:\ windows \ system32 \ cmd.exe /s /c“” c:\ program Files \ android \ android \ android \ sdk \ sdk \ platform-tools \ \ \ adb.exe“ -s rf8nnnnxhy shell” pm install -r/data/local/tmp/907bcea56cddef5e078d901e601e60af5d98.apk“
info:[debug]错误:命令失败:c:\ windows \ system32 \ cmd.exe /s /c”“ c:\ program files \ android \ android \ sdk \ sdk \ platform -tools \ adb.exe” -s rf8nnnnnnnnnxhy shell“ pm install -r/data/local/tmp/907bcea56cddef5e078d901e60af5d98.apk”
在childprocess.exithandler(child_process.js:751:12) 在ChildProcess.emit(event.js:110:17) 在Maybeclose(child_process.js:1016:16) at Process.ChildProcess._handle.Onexit(child_process.js:1088:5)
info:[debug]以错误:{“状态”:33,“ value”:{“ message”:“无法创建一个新的会话。(原始错误:命令失败:C:\ Windows) \system32\cmd.exe /s /c ""C:\Program Files\Android\Sdk\platform-tools\adb.exe" -s RF8N21BNXHY shell "pm install -r /data/local/tmp/907bcea56cddef5e078d901e60af5d98.apk" “ \ n)”,“杀死”:false,“代码”:1,“信号”:null,“ cmd”:“ C:\ Windows \ System32 \ cmd.exe /s /c” \ android \ sdk \ platform -tools \ adb.exe“ -s rf8nn21bnxhy shell” pm install -r/data/local/tmp/907bcea56cddef5e078d98d901e601e601e60af5d98.apk 598.apk ".apqumand::firstered firstered firstered firstered firstered::et et y:et y:comm“commourigvalue et:”couligoutile coumcoum couligoutecoum couligouriue \ cmd.exe /s /c“” c:\程序文件\ android \ sdk \ platform -tools \ adb.exe“ -s rf8nn21bnxhy shell” pm install -r /data/local/tmp/907BCEA56BCEA56CDDEF5E5E078D901E60AFKER n“},“ sessionid”:null} 信息:< - POST/WD/HUB/SESSION 500 29539.987 MS-784
请帮助我进行调试,谢谢。
Here is my code:
@Test
public void testAppium() throws MalformedURLException{
//Capabilities
DesiredCapabilities capability = new DesiredCapabilities();
capability.setCapability("platformName", "Android");
// Nexus Device
//capability.setCapability("deviceName", "Nexus 5");
//capability.setCapability("platformVersion", "6.0.1");
//capability.setCapability("udid","RF8N21BNXHY");
// Galaxy S20
capability.setCapability("deviceName", "Galaxy S20");
capability.setCapability("platformVersion", "12");
capability.setCapability("udid","RF8N21BNXHY");
capability.setCapability("appWaitPackage", "abc");
capability.setCapability("appWaitActivity","abc");
File file = new File("C:\\Users\\ShahreenMushtaq\\new\\Test\\app-zameen-live-release
(1).apk");
capability.setCapability("app", file.getAbsolutePath());
Same code is working for Nexus device having OS version 6.0.1, but not working for samsung devices.
Error:
error: Failed to start an Appium session, err was: Error: Command failed: C:\Windows\system32\cmd.exe /s /c ""C:\Program Files\Android\Sdk\platform-tools\adb.exe" -s RF8N21BNXHY shell "pm install -r /data/local/tmp/907bcea56cddef5e078d901e60af5d98.apk""
info: [debug] Error: Command failed: C:\Windows\system32\cmd.exe /s /c ""C:\Program Files\Android\Sdk\platform-tools\adb.exe" -s RF8N21BNXHY shell "pm install -r /data/local/tmp/907bcea56cddef5e078d901e60af5d98.apk""
at ChildProcess.exithandler (child_process.js:751:12) at ChildProcess.emit (events.js:110:17) at maybeClose (child_process.js:1016:16) at Process.ChildProcess._handle.onexit (child_process.js:1088:5)
info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Command failed: C:\Windows\system32\cmd.exe /s /c ""C:\Program Files\Android\Sdk\platform-tools\adb.exe" -s RF8N21BNXHY shell "pm install -r /data/local/tmp/907bcea56cddef5e078d901e60af5d98.apk""\n)","killed":false,"code":1,"signal":null,"cmd":"C:\Windows\system32\cmd.exe /s /c ""C:\Program Files\Android\Sdk\platform-tools\adb.exe" -s RF8N21BNXHY shell "pm install -r /data/local/tmp/907bcea56cddef5e078d901e60af5d98.apk""","origValue":"Command failed: C:\Windows\system32\cmd.exe /s /c ""C:\Program Files\Android\Sdk\platform-tools\adb.exe" -s RF8N21BNXHY shell "pm install -r /data/local/tmp/907bcea56cddef5e078d901e60af5d98.apk""\n"},"sessionId":null}
info: <-- POST /wd/hub/session 500 29539.987 ms - 784
Kindly help me in debugging, Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
实际上,您的file_path可能会出现问题。
您可以尝试以下帽子吗?
但是首先从设备卸载您的Appium设置。随之而来的是这些更改。
在Windows(\ filename.apk)上提供文件路径中的路径示例:
Actually there can be issue on to your file_path.
Can you try with below caps.
But first uninstall your appium setting from device. And along with this do these changes.
Provide path in file path on windows(\filename.apk) example: