Java.lang.RuntimeException:Canvas:trying to draw too large (203212800bytes) bitmap.

Source: Internet
Author: User
Java.lang.RuntimeException:Canvas:trying to draw too large (203212800bytes) bitmap.

Exception reason analysis: Canvas drawing bitmap need memory is too big, oom, directly on the crash.

Cause 1: The picture is too big to change the size of the picture to solve.

Cause 2: Picture placement unreasonable, if only mipmap-*dpi a few folders, no drawable-*dpi corresponding folder, only the default drawable folder, put the picture under the Drawable folder

will lead to the above exception, if your device needs drawable-xxhdpi under the resources, then only need to move the picture from drawable to drawable-xxhdpi can be resolved.

Or create a new drawable-nodpi folder and move the picture resource to the drawable-nodpi folder.

In this case, the Android device will automatically enlarge the image resource under drawable by default N*n, regenerate a bitmap, then load again, then the Oom,crash will appear.

Java.lang.RuntimeException:Canvas:trying to draw too large (203212800bytes) bitmap.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.