Downloading a Gif image from Android using aws transfer utility crashes

I use aws-android-sdk-core-2.4.4.jar and aws-android-sdk-s3-2.4.4.jar to upload images and aws server gifs .

if (BitmapUtils.checkImageUrl(path) == BitmapUtils.IMAGE_GIF) {
       ObjectMetadata metadata = new ObjectMetadata();
       metadata.setContentType("image/gif");
       File file = new File(path);
       observer = transferUtility.upload(Constants.BUCKET_NAME, AWSUtil.getRandomName(path), new File(path), metadata);
} else
       observer = transferUtility.upload(Constants.BUCKET_NAME, AWSUtil.getRandomName(path), new File(path));

ImageDownloading works great. but when it comes to gif, sometimes it loads, and sometimes not. To be precise, it boots for the first time and crashes after you select an error

java.lang.IllegalArgumentException: Invalid file: 
/storage/emulated/0/Download/cartoon_birds_blue_flying_animation_clipart.gif

when I check mine gifin the galleryIt only shows a white or black screen, it gifdoes not load.

Please offer me any ideas to fix this problem.
Thank.

+4

Source: https://habr.com/ru/post/1681447/


All Articles