Gif image uploading from android using aws transfer utility causes crash

Viewed 459

I am using aws-android-sdk-core-2.4.4.jar and aws-android-sdk-s3-2.4.4.jar for uploading images and gifs to aws server.

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));

Image uploading is working great. but when it comes to gif, sometimes it uploads and sometimes not. To be exact, it uploads for first time and crashes after that throwing error

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

when i check my gif in gallery, it shows white or black screen only, gif is not loaded.

Please suggest me any ideas to fix this issue.
Thanks.

0 Answers
Related