title: junit.framework.AssertionFailedError: Back button can't be pressed
body: <p>I am doing this for exit an application using <strong>Android UIAutomator</strong>.</p>
  
  <pre><code>assertTrue("Back button can't be pressed", getUiDevice().pressBack());
  
  assertTrue("Back button can't be pressed", getUiDevice().pressBack());   // This line will giving exception.
  </code></pre>
  
  <p>My application will exit when we press <em>two times back button</em> that's why i am calling it twice. </p>
  
  <p>But </p>
  
  <p>Then it will give me exception.</p>
  
  <p>But when i'm doing it manually back twice it will work perfectly.</p>
  
  <p><strong>Exception is:</strong></p>
  
  <pre><code>junit.framework.AssertionFailedError: Back button can't be pressed
          at com.android.jdsu.automation.youtube.YoutubeUiTest.exitApplicaion(Yout
  ubeUiTest.java:487)
          at com.android.jdsu.automation.youtube.YoutubeUiTest.testYouTube(Youtube
  UiTest.java:208)
          at java.lang.reflect.Method.invokeNative(Native Method)
          at com.android.uiautomator.testrunner.UiAutomatorTestRunner.start(UiAuto
  matorTestRunner.java:160)
          at com.android.uiautomator.testrunner.UiAutomatorTestRunner.run(UiAutoma
  torTestRunner.java:96)
          at com.android.commands.uiautomator.RunTestCommand.run(RunTestCommand.ja
  va:91)
          at com.android.commands.uiautomator.Launcher.main(Launcher.java:83)
          at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
          at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:243)
          at dalvik.system.NativeStart.main(Native Method)
  
  INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
  INSTRUMENTATION_STATUS: test=testYouTube
  INSTRUMENTATION_STATUS: class=com.android.jdsu.automation.youtube.YoutubeUiTest
  INSTRUMENTATION_STATUS: stack=junit.framework.AssertionFailedError: Back button
  can't be pressed
          at com.android.jdsu.automation.youtube.YoutubeUiTest.exitApplicaion(Yout
  ubeUiTest.java:487)
          at com.android.jdsu.automation.youtube.YoutubeUiTest.testYouTube(Youtube
  UiTest.java:208)
          at java.lang.reflect.Method.invokeNative(Native Method)
          at com.android.uiautomator.testrunner.UiAutomatorTestRunner.start(UiAuto
  matorTestRunner.java:160)
          at com.android.uiautomator.testrunner.UiAutomatorTestRunner.run(UiAutoma
  torTestRunner.java:96)
          at com.android.commands.uiautomator.RunTestCommand.run(RunTestCommand.ja
  va:91)
          at com.android.commands.uiautomator.Launcher.main(Launcher.java:83)
          at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
          at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:243)
          at dalvik.system.NativeStart.main(Native Method)
  </code></pre>