我正在使用压缩库来压缩图像。
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)
当我找到图片时,这是官方文件路径
我已确认我具有读取和写入外部存储权限,方法是将它们添加到清单中以及在活动中请求权限。
我尝试通过添加以下内容来获取绝对文件路径:
File absoluteCroppedImagePath = new File(croppedImagePath.getAbsolutePath());
但是文件路径没有改变。