react-native-compress-image
react-native-compress-image copied to clipboard
Fatal Exception: java.lang.NullPointerException
Attempt to invoke virtual method 'boolean android.graphics.Bitmap.compress(android.graphics.Bitmap$CompressFormat, int, java.io.OutputStream)' on a null object reference com.emekalites.react.compress.image.ImageUtil.compressImage
Device Brand: LGE Model: LG K10 LTE Orientation: Portrait RAM free: 179.56 MB Disk free: 6.02 GB Operating System Version: 6.0 Orientation: Portrait Rooted: No
Other devices are Tecno Spark, Tecno Camen I, Samsung Galaxy S5, Galaxy J2, Xiomi Redmi 5. Mostly Seen in Android 5, Android 6, and Android 7.
The error is seen multiple times in the above device.
It is coming in the compressImage
method present in the ImageUtil.java
file.
When the decodeSampledBitmapFromFile
returns a null
from the catch
section to the compressImage
method, the decodeSampledBitmapFromFile(imageFile, reqWidth, reqHeight).compress(compressFormat, quality, fileOutputStream);
ends up as null.compress(compressFormat, quality, fileOutputStream);
Please Help. Thanks.