Here is the error
error: Failed to start an Appium session, err was: Error: Command failed: C:\WINDOWS\system32\cmd.exe /s /c "C:\Users\seema\AppData\Local\Android\sdk1\platform-tools\adb.exe -s emulator-5554 shell "ps 'uiautomator'""
info: [debug] Error: Command failed: C:\WINDOWS\system32\cmd.exe /s /c "C:\Users\seema\AppData\Local\Android\sdk1\platform-tools\adb.exe -s emulator-5554 shell "ps 'uiautomator'""
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:\Users\seema\AppData\Local\Android\sdk1\platform-tools\adb.exe -s emulator-5554 shell \"ps 'uiautomator'\"\"\n)","killed":false,"code":1,"signal":null,"cmd":"C:\WINDOWS\system32\cmd.exe /s /c \"C:\Users\seema\AppData\Local\Android\sdk1\platform-tools\adb.exe -s emulator-5554 shell \"ps 'uiautomator'\"\"","origValue":"Command failed: C:\WINDOWS\system32\cmd.exe /s /c \"C:\Users\seema\AppData\Local\Android\sdk1\platform-tools\adb.exe -s emulator-5554 shell \"ps 'uiautomator'\"\"\n"},"sessionId":null}
info: <-- POST /wd/hub/session 500 87388.608 ms - 676
Using latest appium jar as well as server.
Code is as follows:
import static org.junit.Assert.*;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.TimeUnit;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.remote.MobileCapabilityType;
import io.appium.java_client.remote.MobilePlatform;
import org.junit.Test;
import org.openqa.selenium.remote.DesiredCapabilities;
public class desiredcapabilities {
@Test
public void test() throws MalformedURLException, InterruptedException {
File appDir = new File("src");
File app = new File(appDir,"BookMyShow.apk");
DesiredCapabilities cap=new DesiredCapabilities();
cap.setCapability(MobileCapabilityType.PLATFORM_NAME,MobilePlatform.ANDROID);
cap.setCapability(MobileCapabilityType.DEVICE_NAME, "Android Emulator");
cap.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, "100");
cap.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());
AndroidDriver driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"),cap);
driver.manage().timeouts().implicitlyWait(80, TimeUnit.SECONDS);
}
}
I am using emulator