galleryfinal框架截取图片旋转或者闪退

安卓开发用galleryfinal框架的小伙伴在跳转截取图片时旋转问题或者闪退,

ExifInterface only supports saving attributes on JPEG formats.
android.media.ExifInterface.saveAttributes(ExifInterface.java:1788)

其实原因出在CropUtil类中异常捕获那里

 public static boolean copyExifRotation(File sourceFile, File destFile) {
        if (sourceFile == null || destFile == null) return false;
        try {
            ExifInterface exifSource = new ExifInterface(sourceFile.getAbsolutePath());
            ExifInterface exifDest = new ExifInterface(destFile.getAbsolutePath());
            exifDest.setAttribute(ExifInterface.TAG_ORIENTATION, exifSource.getAttribute(ExifInterface.TAG_ORIENTATION));
            exifDest.saveAttributes();
            return true;
        } catch (IOException e) {
            //出现异常的时候会出现死循环。注释掉即可
//            ILogger.e(e);
            return false;
        }
    }

你可能感兴趣的:(android随笔)