codelab-android-workmanager icon indicating copy to clipboard operation
codelab-android-workmanager copied to clipboard

Crash when starting the app on branch `start_kotlin` using xxhdpi device

Open PierreVieira opened this issue 4 years ago • 0 comments

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

PierreVieira avatar Nov 01 '21 22:11 PierreVieira