Crash on app start caused by empty resources

Open
#645 0 comments 0 reactions 0 assignees View on GitHub

@bradh is already working on this.

Since Nov 1, 2026.

  • #646 by @bradh — open

Assessment

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

Research direction

The crash comes from zero-byte PNGs in app/src/main/res/drawable-xhdpi, such as img_keyart_multimodal.png, which the logcat trace shows failing in imageResource. Pull request 646 is already open against this issue, so review it before starting. Done means the app starts on the Samsung tablet and the empty drawables are either restored or no longer referenced.

Written by the indexing model from the issue text.

Description

The application fails to start on a Samsung SM-X520 tablet.

The backtrace suggests failing to load the img_keyart_multimodal.png resource. See below.

That is likely because that resource (and several others) are empty.

~/camera-samples/app/src/main/res/drawable-xhdpi$ ls -la
total 5024
drwxrwxr-x  2 bradh bradh    4096 Nov  1 17:35 .
drwxrwxr-x 16 bradh bradh    4096 Nov  1 17:35 ..
-rw-rw-r--  1 bradh bradh 5134398 Nov  1 17:35 img_bg_landing.png
-rw-rw-r--  1 bradh bradh       0 Nov  1 17:35 img_keyart_chatbot.png
-rw-rw-r--  1 bradh bradh       0 Nov  1 17:35 img_keyart_imagen.png
-rw-rw-r--  1 bradh bradh       0 Nov  1 17:35 img_keyart_img_desc.png
-rw-rw-r--  1 bradh bradh       0 Nov  1 17:35 img_keyart_magic_selfie.png
-rw-rw-r--  1 bradh bradh       0 Nov  1 17:35 img_keyart_metadata.png
-rw-rw-r--  1 bradh bradh       0 Nov  1 17:35 img_keyart_multimodal.png
-rw-rw-r--  1 bradh bradh       0 Nov  1 17:35 img_keyart_summary.png
-rw-rw-r--  1 bradh bradh       0 Nov  1 17:35 img_keyart_text.png
-rw-rw-r--  1 bradh bradh       0 Nov  1 17:35 img_keyart_todo.png
-rw-rw-r--  1 bradh bradh       0 Nov  1 17:35 img_keyart_video_summary.png

From logcat:

026-11-01 20:19:28.237 19374-19374 ComposeInternal         com.android.camera.catalog           E  Error was captured in composition.
                                                                                                    androidx.compose.ui.res.ResourceResolutionException: Error attempting to load resource: res/drawable-xhdpi-v4/img_keyart_multimodal.png
                                                                                                    	at androidx.compose.ui.res.PainterResources_androidKt.loadImageBitmapResource(PainterResources.android.kt:112)
  ...
                                                                                                    Caused by: java.lang.NullPointerException: null cannot be cast to non-null type android.graphics.drawable.BitmapDrawable
                                                                                                    	at androidx.compose.ui.res.ImageResources_androidKt.imageResource(ImageResources.android.kt:39)
...
                                                                                                    Caused by: java.lang.NullPointerException: null cannot be cast to non-null type android.graphics.drawable.BitmapDrawable
                                                                                                    	at androidx.compose.ui.res.ImageResources_androidKt.imageResource(ImageResources.android.kt:39)
...
``
Dominant language
Kotlin
Stars
5.5k
Forks
2.4k
Avg merge
34m
Merged PRs (30d)
1

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from android/camera-samples

All issues in android/camera-samples

Similar issues

More Kotlin issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.