错误:打开失败:没有这样的文件或目录

时间:2020-06-19 08:24:40

标签: android storage

我正在使用压缩库来压缩图像。

File croppedImagePath = new File(imageUri.getPath());

             try {
                 croppedBitmap = new Compressor(getActivity()).compressToBitmap(croppedImagePath);
             } catch (IOException e) {
                e.printStackTrace();
             }

错误:

Unable to decode stream: java.io.FileNotFoundException: /document/image:25: open failed: ENOENT (No such file or directory)

当我找到图片时,这是官方文件路径

Football Image

我已确认我具有读取和写入外部存储权限,方法是将它们添加到清单中以及在活动中请求权限。

我尝试通过添加以下内容来获取绝对文件路径:

File absoluteCroppedImagePath = new File(croppedImagePath.getAbsolutePath());

但是文件路径没有改变。

0 个答案:

没有答案