Java Android FileNotFoundException,即使文件可用且权限已设置
我正在将相机拍摄的图像保存到外部存储器中。稍后,我想上传图像到我们的服务器 在那里,我尝试从路径重新创建文件,但始终会出现FileNotFoundExceptionJava Android FileNotFoundException,即使文件可用且权限已设置,java,android,filenotfoundexception,Java,Android,Filenotfoundexception,我正在将相机拍摄的图像保存到外部存储器中。稍后,我想上传图像到我们的服务器 在那里,我尝试从路径重新创建文件,但始终会出现FileNotFoundException File file = new File("file:/storage/emulated/0/Pictures/Instantley/IMG_20160523_170354803382833.jpg"); 我已经检查过: 文件可用(查阅照片应用程序并检查url) 设置清单中的外部读取权限 请求的运行时权限 原因:android.
File file = new File("file:/storage/emulated/0/Pictures/Instantley/IMG_20160523_170354803382833.jpg");
我已经检查过:
- 文件可用(查阅照片应用程序并检查url)
- 设置清单中的外部读取权限
- 请求的运行时权限
原因:android.system.ErrnoException:open失败:enoint(没有这样的文件或目录) 05-23 17:04:33.014 1918-1918/com.instantley.messenger W/System.err:at libcore.io.Posix.open(本机方法) 05-23 17:04:33.014 1918-1918/com.instantley.messenger W/System.err:at libcore.io.BlockGuardOs.open(BlockGuardOs.java:186) 05-23 17:04:33.015 1918-1918/com.instantley.messenger W/System.err:at libcore.io.IoBridge.open(IoBridge.java:438)
file = new File("/storage/emulated/0/Pictures/Instantley/IMG_20160523_170354803382833.jpg");
请尝试打印文件路径并检查您是否正确使用了路径名。我建议您检查一下