qq_35071078
下课睡觉
2017-01-05 03:29
采纳率: 45.7%
浏览 2.0k

ANDROID 读取系统图片失败

我是先获取了系统图库里的某个图片的路径 path,然后
File file = new File(path);
InputStream is = new FileInputStream(file);
然后就报错W/System.err: java.io.FileNotFoundException: /storage/emulated/0/Tencent/QQ_Images/null-52a51a941f2792db.jpg: open failed: EACCES (Permission denied)
W/System.err: at libcore.io.IoBridge.open(IoBridge.java:459)
W/System.err: at java.io.FileInputStream.(FileInputStream.java:76)
W/System.err: at com.fc.net.UploadUtil.uploadFile(UploadUtil.java:72)
W/System.err: at com.fc.ui.activity.club.CreateClubActivity$3.run(CreateClubActivity.java:149)
W/System.err: Caused by: android.system.ErrnoException: open failed: EACCES (Permission denied)
W/System.err: at libcore.io.Posix.open(Native Method)
W/System.err: at libcore.io.BlockGuardOs.open(BlockGuardOs.java:186)
W/System.err: at libcore.io.IoBridge.open(IoBridge.java:445)
W/System.err: ... 3 more

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

3条回答 默认 最新

  • stone_you
    stone_you 2017-01-05 05:48
    已采纳

    你的tagetsdk大于等于23吗?如果是的话,需要动态申请权限,在manifest里申请是不行的

    点赞 评论
  • qq626215761
    qq626215761 2017-01-05 03:36

    没有申请文件读写权限

    点赞 评论
  • yinwending
    MRyinwending 2017-01-12 09:17

    代码动态申请读写权限

    点赞 评论

相关推荐