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.
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: