Fix Note: OutOfMemory of Android Crop Library

Error Log screenshot

Open source Library:
Platform: Android

Today I finally fixed the OutOfMemory problem of the image crop library that I used to crop the profile picture given from the user;

The problem happened when a high-resolution image is being inputted, e.g over 1M to crop; Android hits an OutOfMemory problem when decoding the image;

It is easy to solve the above problem, simply set the SIZE_LIMIT value in
  • The origin value is 4096, it may crash if the device isn’t having enough memory like my phone;
  • The safe value is 1024, which I am using it to fix the problem;

Source location:

Change From:

<div>private static final int SIZE_LIMIT = 4096;</div>

<div>private static final int SIZE_LIMIT = 1024;</div>

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s