拷贝文件时FileNotFoundException:Permission denied

在进行拷贝过程中,发现 :

System.err: java.io.FileNotFoundException: /data/xgimilog/logcat.log: open failed: EACCES (Permission denied)

具体如下:

06-02 08:03:19.786  8195  8533 D BugxxxService: copyFile: /data/xxxxxlog/logcat.log;destFile:/storage/738B-6C66/xxxxxlog/xxxxxlog/logcat.log
06-02 08:03:19.787  8195  8533 W System.err: java.io.FileNotFoundException: /data/xxxxxlog/logcat.log: open failed: EACCES (Permission denied)
06-02 08:03:19.788  8195  8533 W System.err:    at libcore.io.IoBridge.open(IoBridge.java:492)
06-02 08:03:19.789  8195  8533 W System.err:    at java.io.FileInputStream.<init>(FileInputStream.java:160)
06-02 08:03:19.789  8195  8533 W System.err:    at com.xxxxx.bugxxxsender.Utils.FileUtils.copyFile(FileUtils.java:43)
06-02 08:03:19.790  8195  8533 W System.err:    at com.xxxxx.bugxxxsender.BugreportService.copyFiles(BugxxxService.java:94)
06-02 08:03:19.790  8195  8533 W System.err:    at com.xxxxx.bugxxxsender.BugxxxService.onHandleIntent(BugxxxService.java:58)
06-02 08:03:19.790  8195  8533 W System.err:    at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:77)
06-02 08:03:19.790  8195  8533 W System.err:    at android.os.Handler.dispatchMessage(Handler.java:106)
06-02 08:03:19.790  8195  8533 W System.err:    at android.os.Looper.loop(Looper.java:223)
06-02 08:03:19.790  8195  8533 W System.err:    at android.os.HandlerThread.run(HandlerThread.java:67)
06-02 08:03:19.790  8195  8533 W System.err: Caused by: android.system.ErrnoException: open failed: EACCES (Permission denied)
06-02 08:03:19.790  8195  8533 W System.err:    at libcore.io.Linux.open(Native Method)
06-02 08:03:19.790  8195  8533 W System.err:    at libcore.io.ForwardingOs.open(ForwardingOs.java:166)
06-02 08:03:19.790  8195  8533 W System.err:    at libcore.io.BlockGuardOs.open(BlockGuardOs.java:254)
06-02 08:03:19.790  8195  8533 W System.err:    at libcore.io.ForwardingOs.open(ForwardingOs.java:166)
06-02 08:03:19.791  8195  8533 W System.err:    at android.app.ActivityThread$AndroidOs.open(ActivityThread.java:7542)

应用是系统应用,且sharedUserId为:android.uid.system;该给的权限也都给了,selinux关闭后也有同样的问题。

最后分析是跟要打开的文件(data/xxxxxlog/logcat.log)的权限有关,查看文件的权限,只是普通的-rw-------;通过chmod 777 /data/xxxxxlog/logcat.log后,可以拷贝不会报错。

最终通过修改权限解决此问题:

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值