我有一个应用程序可以复制和修改文件的权限。但是当我尝试读取所述文件时,我的权限被拒绝。
java.io.FileNotFoundException:/data/data/com.lstupenengo.primeraapp/files/xx:打开失败:EACCES(权限被拒绝)
我如何知道 RootTools 何时完成?
我的代码:
RootTools.copyFile("/data/data/com.xxx/" + file, getFilesDir() +"/"+ file, true, false);
CommandCapture cmd = new CommandCapture(0,"chmod 777 "+getFilesDir()+"/"+file);
try {
RootTools.getShell(true).add(cmd);
} catch (TimeoutException | RootDeniedException | IOException e) {
e.printStackTrace();
Log.e("Root "+file, "Fallo");
}
File fts = new File(getFilesDir()+"/"+file);
FileInputStream fis = new FileInputStream(fts); //Here I get my error.
日志猫
12-18 16:23:41.874 30092-30806/com.lstupenengo.primeraapp W/System.err﹕ java.io.FileNotFoundException: /data/data/com.lstupenengo.primeraapp/files/xx: open failed: EACCES (Permission denied)
12-18 16:23:41.874 30092-30806/com.lstupenengo.primeraapp W/System.err﹕ at libcore.io.IoBridge.open(IoBridge.java:418)
12-18 16:23:41.874 30092-30806/com.lstupenengo.primeraapp W/System.err﹕ at java.io.FileInputStream.<init>(FileInputStream.java:78)
12-18 16:23:41.874 30092-30806/com.lstupenengo.primeraapp W/System.err﹕ at com.lstupenengo.primeraapp.myFTP.upload(myFTP.java:80)
12-18 16:23:41.874 30092-30806/com.lstupenengo.primeraapp W/System.err﹕ at com.lstupenengo.primeraapp.FirstRunService.upload(FirstRunService.java:75)
12-18 16:23:41.874 30092-30806/com.lstupenengo.primeraapp W/System.err﹕ at com.lstupenengo.primeraapp.FirstRunService.onHandleIntent(FirstRunService.java:47)