title: Unable to create new remote session. Appium
body: <pre><code>public class StartFirstJobTest {
  
  AppiumDriver driver;
  @BeforeTest
  public void setUp() throws Exception {
      DesiredCapabilities capabilities = new DesiredCapabilities();
      capabilities.setCapability("deviceName", "F4AZFG07P508");
      //capabilities.setCapability("platformName","Android");
      //capabilities.setCapability("platformVersion", "5.0");
      driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
  }
  </code></pre>
  
  <p><strong>When I try to run the test, I get this error.</strong></p>
  
  <blockquote>
    <p>org.openqa.selenium.SessionNotCreatedException: Unable to create new
    remote session. desired capabilities = Capabilities
    [{platformName=Android, deviceName=F4AZFG07P508}], required
    capabilities = Capabilities [{}] Build info: version: '3.3.1',
    revision: '5234b325d5', time: '2017-03-10 09:10:29 +0000' System info:
    host: 'MacBook-Pro-Roman.local', ip: 'fe80:0:0:0:77:aef0:77:32%en0',
    os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.12.3',
    java.version: '1.8.0_121' Driver info: driver.version: AndroidDriver</p>
  </blockquote>
  
  <p>I think that I set everything up correctly in the appium (When the inspector starts, the device is installed applications and can be tested)</p>
  
  <p>As a project collector I use Maven</p>
  
  <p>UPD.
  <strong>I'm trying to automate the application. I specified additional capabilities in the code</strong> </p>
  
  <pre><code>    @BeforeTest
  public void setUp() throws Exception {
      File app = new File("/Users/romanderabin/Downloads/TimeTracker.apk");
      DesiredCapabilities capabilities = new DesiredCapabilities();
      capabilities.setCapability("deviceName","F4AZFG07P508");
      capabilities.setCapability("platformVersion", "5.0");
      capabilities.setCapability("platformName", "Android");
      capabilities.setCapability("app", app.getAbsolutePath());
      capabilities.setCapability("appPackage", "com.ronasit.timetrackerandroid");
      capabilities.setCapability("appActivity","com.ronasit.timetrackerandroid.MainActivity");
      driver = new AndroidDriver(new URL("http://127.0.0.1:4727/wd/hub/"), capabilities);
  </code></pre>
  
  <p><strong>and the error is the same</strong></p>
  
  <blockquote>
    <p>org.openqa.selenium.SessionNotCreatedException: Unable to create new
    remote session. desired capabilities = Capabilities
    [{app=/Users/romanderabin/Downloads/TimeTracker.apk,
    appPackage=com.ronasit.timetrackerandroid,
    appActivity=com.ronasit.timetrackerandroid.MainActivity,
    platformVersion=5.0, platformName=Android, deviceName=F4AZFG07P508}],
    required capabilities = Capabilities [{}] Build info: version:
    '3.3.1', revision: '5234b325d5', time: '2017-03-10 09:10:29 +0000'
    System info: host: 'MacBook-Pro-Roman.local', ip:
    'fe80:0:0:0:77:aef0:77:32%en0', os.name: 'Mac OS X', os.arch:
    'x86_64', os.version: '10.12.3', java.version: '1.8.0_121' Driver
    info: driver.version: AndroidDriver</p>
    
    <p>at
    org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:126)
      at
    org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:141)
      at
    io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:69)
      at
    org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:604)
      at
    io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:40)
      at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
      at
    io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
      at
    org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:244)
      at
    org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:131)
      at
    org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:144)
      at
    io.appium.java_client.DefaultGenericMobileDriver.(DefaultGenericMobileDriver.java:36)
      at io.appium.java_client.AppiumDriver.(AppiumDriver.java:114)
      at io.appium.java_client.AppiumDriver.(AppiumDriver.java:132)
      at
    io.appium.java_client.android.AndroidDriver.(AndroidDriver.java:92)
      at StartFirstJobTest.setUp(StartFirstJobTest.java:30)   at
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)   at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)     at
    org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
      at
    org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:510)
      at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:211)
      at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:138)
      at org.testng.TestRunner.beforeRun(TestRunner.java:648)     at
    org.testng.TestRunner.run(TestRunner.java:616)    at
    org.testng.SuiteRunner.runTest(SuiteRunner.java:359)  at
    org.testng.SuiteRunner.runSequentially(SuiteRunner.java:354)  at
    org.testng.SuiteRunner.privateRun(SuiteRunner.java:312)   at
    org.testng.SuiteRunner.run(SuiteRunner.java:261)  at
    org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)  at
    org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)   at
    org.testng.TestNG.runSuitesSequentially(TestNG.java:1191)     at
    org.testng.TestNG.runSuitesLocally(TestNG.java:1116)  at
    org.testng.TestNG.run(TestNG.java:1024)   at
    org.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:72)     at
    org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:127)     at
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)   at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)     at
    com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)</p>
    
    <p>Test ignored.</p>
  </blockquote>
  
  <p><strong>Appium logs when I'm trying start test</strong></p>
  
  <blockquote>
    <p>[HTTP] --> POST /wd/hub/session
    {"desiredCapabilities":{"app":"/Users/romanderabin/Downloads/TimeTracker.apk","appPackage":"com.ronasit.timetrackerandroid","appActivity":"com.ronasit.timetrackerandroid.MainActivity","platformVersion":"5.0","platformName":"Android","deviceName":"F4AZFG07P508"},"requiredCapabilities":{},"capabilities":{"desiredCapabilities":{"app":"/Users/romanderabin/Downloads/TimeTracker.apk","appPackage":"com.ronasit.timetrackerandroid","appActivity":"com.ronasit.timetrackerandroid.MainActivity","platformVersion":"5.0","platformName":"Android","deviceName":"F4AZFG07P508"},"requiredCapabilities":{}},"alwaysMatch":{"app":"/Users/romanderabin/Downloads/TimeTracker.apk","appPackage":"com.ronasit.timetrackerandroid","appActivity":"com.ronasit.timetrackerandroid.MainActivity","platformVersion":"5.0","platformName":"Android","deviceName":"F4AZFG07P508"},"firstMatch":[]}</p>
    
    <p>[debug] [MJSONWP] Bad parameters: BadParametersError: Parameters were
    incorrect. We wanted
    {"required":["desiredCapabilities"],"optional":["requiredCapabilities","sessionId","id"]}
    and you sent
    ["desiredCapabilities","requiredCapabilities","capabilities","alwaysMatch","firstMatch"]</p>
    
    <p>[HTTP] &lt;-- POST /wd/hub/session 400 4 ms - 228</p>
  </blockquote>