I have an app in production and am getting a lot of crashes on Galaxy devices.
Stacktrace:
java.lang.OutOfMemoryError at android.graphics.Bitmap.nativeCreate(Native Method) at android.graphics.Bitmap.createBitmap(Bitmap.java:669) at android.graphics.Bitmap.createBitmap(Bitmap.java:604) at android.graphics.Bitmap.createBitmap(Bitmap.java:530) at com.edmodo.cropper.CropImageView.getCroppedImage(CropImageView.java:357) at com.myapp.app.MyPhotoActivity$3.onClick(MyPhotoActivity.java:308) at android.view.View.performClick(View.java:4191) at android.view.View$PerformClick.run(View.java:17229) at android.os.Handler.handleCallback(Handler.java:615) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4960) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805) at dalvik.system.NativeStart.main(Native Method)
Types of devices:
Galaxy S2 (GT-I9100T) Galaxy S2 (SGH-T989) Galaxy Note II (t03g)
Galaxy Note2 (t0ltetmo) Galaxy Note2 (t0ltespr) Galaxy S3 (d2vmu)
Electrify M (solstice) Galaxy S5 (kltespr) Galaxy Exhibit (codinaMetroPCS) Galaxy S3 (d2tmo) Galaxy S3 (d2ltetmo) Galaxy S2 Epic (SPH-D710) Galaxy Win (delos3geur)
CropImageView
// Crop the subset from the original Bitmap. (line 357 below)
final Bitmap croppedBitmap = Bitmap.createBitmap(mBitmap,
(int) actualCropX,
(int) actualCropY,
(int) actualCropWidth,
(int) actualCropHeight);
return croppedBitmap;
}
MyPhotoActivity
usePhotoButton.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View view) {
// line 308 below
finalResizedBitmap = getResizedBitmap(mImageView.getCroppedImage(), PHOTO_RESIZE_VALUE, PHOTO_RESIZE_VALUE);
topCropView.setVisibility(View.GONE);
topFinalView.setVisibility(View.VISIBLE);
mFinalImageView.setImageBitmap(finalResizedBitmap);
usePhotoButton.setVisibility(View.GONE);
uploadPhotoButton.setEnabled(true);
uploadPhotoButton.setVisibility(View.VISIBLE);
}
});
The problem is I don't have any of these devices to test with - any ideas??