【发布时间】:2014-03-01 19:10:09
【问题描述】:
我需要访问另一个应用程序的私有文件夹中包含的文件。我已授予我的应用程序 root 权限并更改了权限 - 虽然我认为没有必要 - 但是当我尝试从文件中读取时,我得到“权限被拒绝”。
这是代码:
File file = new File("/data/data/other.app/shared_prefs/file.xml");
if(file.exists()) {
try {
Runtime.getRuntime().exec("su");
Runtime.getRuntime().exec("chmod 777 " + file.getAbsolutePath());
InputStream in = new FileInputStream(file);
....
} catch (IOException e) {
e.printStackTrace();
}
}
【问题讨论】:
-
这里不应该是空格"chmod 777"在文件名前?
-
感谢您指出这一点。我已经编辑了代码,但我仍然无法打开文件
标签: android inputstream root