android / android/codelab-android-workmanager

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

Open
#257 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Kotlin
Stars
557
Forks
242
PR merge metrics
No merged PRs in 30d

Description

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](https://stackoverflow.com/a/59794171/11111289):
> 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`

Contributor guide

Open the contributing guide

Research direction

Start on the `start_kotlin` branch by locating the `android_cupcake.png` drawable and its references. Reproduce the launch on an xxhdpi Android device or emulator, then verify that the app starts without the oversized-bitmap crash while retaining the image.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.