Android App crashing on Samsung Galaxy S3 (out of memory error)

前端 未结 4 2026
借酒劲吻你
借酒劲吻你 2021-02-05 13:02

I have an Android app that takes some pictures, re-sizes them and sends them over to the back-end server. This app works perfectly fine on all other phones (Gingerbread and Ice

4条回答
  •  囚心锁ツ
    2021-02-05 13:39

    umm... I know it's an old question now, but here's what I think.

    Galaxy S3 uses xhdpi density, therefore allocates bigger heap size on launching, (as far as I know, 32mb)

    but if you don't have any xhdpi resources in your res directory, then it will call any default images in drawable or from hdpi which is the closest to xhdpi density.

    Then it will expand the image to fit it's neeeds, and at this phases expanding the image will take up much memory, (might) resulting in out of memory issues.

    You can either solve this problem by enabling Screen Compatibility Mode or you can just create (if not there by default) drawable-xhdpi, providing Appropriate Resources for xhdpi devices such as Galaxy S3.

提交回复
热议问题