title: Run commands Android Terminal Emulator. Install apk by code
body: <p>I'm trying to run commands on the Android Terminal Emulator. I have my device rooted and I installed <em>superuser.apk</em>.</p>
  
  <p>I'm doing it like this:</p>
  
  <pre><code>    try {
          Process process = Runtime.getRuntime().exec(cmd);
          BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(process.getInputStream()));
          String line = bufferedReader.readLine();
          while ( line != null ) {
              Log.i("SHELL", line);
              line = bufferedReader.readLine();
          }
      } catch ( Exception e) {
          e.printStackTrace();
      }
  </code></pre>
  
  <p>And also well:</p>
  
  <pre><code>    try {
          Process process = Runtime.getRuntime().exec(&lt;b&gt;cmd&lt;/b&gt;*);
          process.waitFor();
      } catch ( Exception e ){
          e.printStackTrace();
      }
  </code></pre>
  
  <p>I'm trying to install a. Apk by code. I tried the following:</p>
  
  <p><strong>cmd</strong> => <code>pm install /mnt/sdcard/app.apk</code>
  Without any results.</p>
  
  <p><strong>cmd</strong> => <code>su -c "pm install /mnt/sdcard/app.apk"</code>
  With single quotes, double quoutes and no quotes. Result:</p>
  
  <pre><code>    I/SHELL(1432): Usage: su [options] [LOGIN]
  
      I/SHELL(1432): Options:
      I/SHELL(1432):   -c, --command COMMAND         pass COMMAND to the invoked shell
      I/SHELL(1432):   -h, --help                    display this help message and exit
      I/SHELL(1432):   -, -l, --login                make the shell a login shell
      I/SHELL(1432):   -s, --shell SHELL             use SHELL instead of the default in passwd
      I/SHELL(1432):   -v, --version                 display version number and exit
      I/SHELL(1432):   -V                            display version code and exit. this is
      I/SHELL(1432):                                 used almost exclusively by Superuser.apk
  </code></pre>
  
  <p>Other commands like <strong>ls</strong> runs fine.</p>
  
  <p><strong>How I can install an apk located in /mnt/sdcard?</strong></p>
  
  <p>Thanks!</p>