Skip to content

Crash when starting the app on branch start_kotlin using xxhdpi device #257

Open

Description

@PierreVieira

I just started the app as proposed in codelab and this happened:

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.example.background, PID: 24751
    java.lang.RuntimeException: Canvas: trying to draw too large(118054944bytes) bitmap.
        at android.view.DisplayListCanvas.throwIfCannotDraw(DisplayListCanvas.java:229)
        at android.view.RecordingCanvas.drawBitmap(RecordingCanvas.java:97)
        at android.graphics.drawable.BitmapDrawable.draw(BitmapDrawable.java:529)
...

Device:

Moto G 5
API Level 27

As described in this answer:

When an image that is only in drawable/folder is used on xxhdpi device, the potentially already big image is upscaled by a factor of 3, which can then in some cases cause the image's memory footprint to explode.

In the case of this project the error is happening due to the drawable android_cupcake.png

Activity

  1. changed the title [-]Crash when starting the app on branch `start_kotlin`[/-] [+]Crash when starting the app on branch `start_kotlin` using xxhdpi device[/+] on Nov 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions