-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Android] Out of memory error with big images #116
Comments
Did the crash appears on the first resize ?
If it's on the first resize you need to allocate more memory to your app. A work around is also to not resized the given image |
No response i close. |
This issue still exists. I need the images to be resized so my server API accepts them. But this always crashes while trying to resize them. From what I could tell, its the BitmapFactory.decodeFile(realPath, options) that is the problem. The solution would be to change the BitmapFactory options as mentioned here --
|
I was running into the same issue. Adding |
We are using this library in our project and we are resizing images to {maxWidth: 1024, maxHeight: 1024}. When we try to pick an image that's very large (16 MB in size) the showImagePicker method crashes with:
FATAL EXCEPTION: main Process: com.devbridge.TeamApp2_Android.debug, PID: 2504 java.lang.OutOfMemoryError: Failed to allocate a 203079692 byte allocation with 4194304 free bytes and 53MB until OOM at dalvik.system.VMRuntime.newNonMovableArray(Native Method) at android.graphics.BitmapFactory.nativeDecodeStream(Native Method) at android.graphics.BitmapFactory.decodeStreamInternal(BitmapFactory.java:635) at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:611) at android.graphics.BitmapFactory.decodeFile(BitmapFactory.java:391) at android.graphics.BitmapFactory.decodeFile(BitmapFactory.java:417) at com.imagepicker.ImagePickerModule.getResizedImage(ImagePickerModule.java:495) at com.imagepicker.ImagePickerModule.onActivityResult(ImagePickerModule.java:400) at com.imagepicker.ImagePickerPackage.handleActivityResult(ImagePickerPackage.java:46)
The issue is not apparent in Android Emulator with enough VM Heap size, but when it's reduced to realistic sizes (64 for example) or when testing on a real device - application crashes as soon as it tries to resize the image.
The text was updated successfully, but these errors were encountered: