title: I am facing this exception org.openqa.selenium.remote.SessionNotFoundException: while using appium on android device
body: <p>org.openqa.selenium.remote.SessionNotFoundException - this exception occurs when I try to debug my code, in between (may be because of delay) the app goes at the background and I start getting this exception. I am not sure if it is because of timeout and if yes, where to increase it in appium, as a capability to driver or at server level? I am putting the while trace here, any help will be appreciated.</p>
  
  <pre><code>2015-12-16 14:30:15,598 ERROR projects.sdk.lib.ObjectsHandler getElement - 
  Command duration or timeout: 8 milliseconds
  Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
  System info: host: 'VDO105-2.local', ip: '192.168.2.1', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.11.2', java.version: '1.7.0_75'
  *** Element info: {Using=xpath, value=//android.widget.ImageView[@resource-id='android:id/home']}
  Session ID: 4787f33a-c66e-46af-842b-3a41836b5d2c
  Driver info: org.openqa.selenium.remote.RemoteWebDriver
  Capabilities [{platform=LINUX, app=/Users/user/Downloads/app-debug.apk, javascriptEnabled=true, browserName=Android, networkConnectionEnabled=true, desired={newCommandTimeout=30, app=/Users/user/Downloads/app-debug.apk, deviceName=Android, platformName=Android, serial=4d0025b440ca90d5}, locationContextEnabled=false, newCommandTimeout=30, platformVersion=5.0, databaseEnabled=false, deviceName=4d0025b440ca90d5, platformName=Android, webStorageEnabled=false, serial=4d0025b440ca90d5, warnings={}, takesScreenshot=true}]
  
  org.openqa.selenium.remote.SessionNotFoundException: 
  Command duration or timeout: 8 milliseconds
  Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
  System info: host: 'VDO105-2.local', ip: '192.168.2.1', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.11.2', java.version: '1.7.0_75'
  *** Element info: {Using=xpath, value=//android.widget.ImageView[@resource-id='android:id/home']}
  Session ID: 4787f33a-c66e-46af-842b-3a41836b5d2c
  Driver info: org.openqa.selenium.remote.RemoteWebDriver
  Capabilities [{platform=LINUX, app=/Users/user/Downloads/app-debug.apk, javascriptEnabled=true, browserName=Android, networkConnectionEnabled=true, desired={newCommandTimeout=30, app=/Users/user/Downloads/app-debug.apk, deviceName=Android, platformName=Android, serial=4d0025b440ca90d5}, locationContextEnabled=false, newCommandTimeout=30, platformVersion=5.0, databaseEnabled=false, deviceName=4d0025b440ca90d5, platformName=Android, webStorageEnabled=false, serial=4d0025b440ca90d5, warnings={}, takesScreenshot=true}]
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
      at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
      at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:164)
      at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:647)
      at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:353)
      at org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteWebDriver.java:490)
      at org.openqa.selenium.By$ByXPath.findElement(By.java:361)
      at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:345)
      at projects.sdk.lib.ObjectsHandler.getElement(ObjectsHandler.java:84)
      at projects.sdk.lib.ObjectsHandler.menuNavigation(ObjectsHandler.java:142)
      at projects.sdk.lib.Actions.performAction(Actions.java:73)
      at projects.sdk.lib.GetResults.getDeviceJsonResult(GetResults.java:170)
      at projects.sdk.lib.GetResults.getResults(GetResults.java:76)
      at projects.sdk.SDKAdServingTest.sdkTest(SDKAdServingTest.java:242)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
      at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
      at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
      at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
      at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
      at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
      at org.testng.TestRunner.privateRun(TestRunner.java:767)
      at org.testng.TestRunner.run(TestRunner.java:617)
      at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
      at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
      at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
      at org.testng.SuiteRunner.run(SuiteRunner.java:240)
      at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
      at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
      at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
      at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
      at org.testng.TestNG.run(TestNG.java:1057)
      at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
      at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
      at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)
  2015-12-16 14:30:20,262 ERROR projects.sdk.lib.ObjectsHandler getElement - 
  Command duration or timeout: 8 milliseconds
  Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
  System info: host: 'VDO105-2.local', ip: '192.168.2.1', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.11.2', java.version: '1.7.0_75'
  *** Element info: {Using=xpath, value=//android.widget.TextView[@text='Banner']}
  Session ID: 4787f33a-c66e-46af-842b-3a41836b5d2c
  Driver info: org.openqa.selenium.remote.RemoteWebDriver
  Capabilities [{platform=LINUX, app=/Users/user/Downloads/app-debug.apk, javascriptEnabled=true, browserName=Android, networkConnectionEnabled=true, desired={newCommandTimeout=30, app=/Users/user/Downloads/app-debug.apk, deviceName=Android, platformName=Android, serial=4d0025b440ca90d5}, locationContextEnabled=false, newCommandTimeout=30, platformVersion=5.0, databaseEnabled=false, deviceName=4d0025b440ca90d5, platformName=Android, webStorageEnabled=false, serial=4d0025b440ca90d5, warnings={}, takesScreenshot=true}]
  </code></pre>