以 可读写的方式加载/data分区
mount -o rw,remount /data
应用上使用
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;
}