Skip to content Skip to sidebar Skip to footer

Java.lang.arithmeticexception: Divide By Zero When Compress Image From Pick Gallery

I'm getting error java.lang.ArithmeticException: divide by zero when compress image from pick gallery. this Is my code: public String compressImage(String filePath, String output

Solution 1:

The fact that you are getting the exception says that division by zero is occurring, and that options.outHeight is returning zero. You need to find out why that is happening. If Log.i("INFO", "ActualHeight Input: " + actualHeight); returns you something other than null, provide us more details.

Solution 2:

Please add the below line on your manifest (inside the Application block).

Android: requestLegacyExternalStorage = "true"

Hope, this will be helpful on this issue.

Post a Comment for "Java.lang.arithmeticexception: Divide By Zero When Compress Image From Pick Gallery"