Android中执行 adb 命令
public static void setPerssion(){
    exusecmd("mount -o rw,remount /data");
    exusecmd("chmod 777 /data/data/shensi");
}
public static boolean exusecmd(String command) {
    Process process = null;
    DataOutputStream os = null;
    try {
        process = Runtime.getRuntime().exec("su");
        os = new DataOutputStream(process.getOutputStream());
        os.writeBytes(command + "\n");
        os.writeBytes("exit\n");
        os.flush();
        process.waitFor();
    } catch (Exception e) {
        return false;
    } finally {
        try {
            if (os != null) {
                os.close();
            }
            if (process != null) {
                process.destroy();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    return true;
}

更多相关文章

  1. Android中的获取内存信息的相关命令
  2. Android笔记1——Android SDK自带的工具和命令
  3. Android 内存分析命令
  4. Android中使用代码执行shell命令
  5. Android pm命令使用方法
  6. Android开发常用的linux命令、命令行操作、抓包等
  7. [ADB]ADB(Android Debug Bridge)简介及基础(不包含命令)

随机推荐

  1. Android实现全屏的方法
  2. Android能否在子线程刷新UI
  3. Android更新ADT到R17以后,不能用第三方ja
  4. Attribute is missing the Android(安卓)
  5. Android中使EditText失去焦点,edittext禁
  6. CardView 设置水波纹效果
  7. Android(安卓)常用控件(三)学习笔记
  8. Android(安卓)Q : 安卓源码、水滴屏适配
  9. Android(安卓)Unable to resolve target
  10. android layout属性 .