具体code ,请参考下面的函数 public boolean execCommand(String cmd){ Process mProcess = null; try { mProcess = Runtime.getRuntime().exec(cmd); mProcess.waitFor(); } catch(Exception e) { return false; } finally { try { mProcess.destroy(); } catch(Exception e){ } } return true; } public void execShell(String cmd ) { Process mProcess = null; try { mProcess = Runtime.getRuntime().exec("su"); OutputStream outputStream = mProcess.getOutputStream(); DataOutputStream dataOutputStream = new DataOutputStream(outputStream); dataOutputStream.writeBytes(cmd); dataOutputStream.flush(); dataOutputStream.close(); } catch (Exception e){ e.printStackTrace(); } }