title: Cannot run program "su" on rooted device
body: <p>I have a rooted phone running Android N (AOSP build). I am trying to get root permissions from my app but it keeps getting permission denied. Here is what I am trying:</p>
  
  <pre><code>java.lang.Process p = runtime.exec("su");
                  DataOutputStream commandLine = new DataOutputStream(p.getOutputStream());
                  commandLine.writeBytes("rm /data/local/tmp/testfile\n");
                  commandLine.flush();
                  p.waitFor();
  </code></pre>
  
  <p>However, it keeps failing with the error: </p>
  
  <pre><code>W/System.err: java.io.IOException: Cannot run program "su": error=13, Permission denied
  W/System.err:     at java.lang.ProcessBuilder.start(ProcessBuilder.java:983)
  W/System.err:     at java.lang.Runtime.exec(Runtime.java:691)
  W/System.err:     at java.lang.Runtime.exec(Runtime.java:524)
  W/System.err:     at java.lang.Runtime.exec(Runtime.java:421)
  W/System.err:     at MainActivity$2.onClick(MainActivity.java:104)
  </code></pre>
  
  <p>I have also added <code>android.permission.ACCESS_SUPERUSER</code> to my manifest but that does not seem to make any difference.</p>