第一种方法:通过执行授权命令
Runtime chg = Runtime.getRuntime();
try {
chg.exec("chmod 777" + " " + recordPath).waitFor();
} catch (Exception e) {
Log.e(TAG, "chmod failed! path = " + recordPath);
}
第二种方法:调用系统的方法
android.os.FileUtils.setPermissions(filePath,
FileUtils.S_IRWXU | FileUtils.S_IRWXG | FileUtils.S_IRWXO,
-1,
-1);