title: Running a adb command programatically Android
body: <p>I am trying to run a adb command programatically in Android before I run a test case. But I get the following exception</p>
  <p><code> runShellCommand exception - Error running exec(). Command: [adb, shell, settings, put, secure, immersive_mode_confirmations, confirmed] Working Directory: null Environment: null</code></p>
  <pre><code>  private void runShellCommand(String command) {
          Timber.d(&quot;runShellCommand&quot;);
          try {
              Process process = Runtime.getRuntime().exec(command);
              process.waitFor();
          } catch (IOException | InterruptedException e) {
              Timber.d(&quot;runShellCommand exception - &quot; + e.getMessage());
              e.printStackTrace();
          }
      }
  </code></pre>
  <p>this is how I call that function with the adb command</p>
  <pre><code>runShellCommand(&quot;adb shell settings put secure immersive_mode_confirmations confirmed&quot;);
  </code></pre>
  <p>Any suggestions on how to fix this please</p>
  <p>Thanks
  R</p>