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;
}
Android中执行adb命令
版权声明:本文为u012492340原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。