MediaGalleryPreviewActivity crashes on Android 13: NPE Class.isInterface() in typed getParcelableExtra
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
Research direction
Open MediaGalleryPreviewActivity.kt and inspect the typed Intent and Bundle parcelable reads described in the report. Compare their API level handling with IntentCompat.getParcelableExtra and BundleCompat.getParcelable, then check the AndroidX compatibility behavior for API 33. The issue is done when the preview opens on Android 13 without the reported crash and the saved state reads use compatible getters.
Written by the indexing model from the issue text.
Description
Describe the bug
MediaGalleryPreviewActivity crashes on Android 13 (API 33) while reading its intent extras, with no app code in the stack:
java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.Class.isInterface()' on a null object reference
at java.lang.Class.isAssignableFrom(Class.java:874)
at android.os.Parcel.readParcelableCreatorInternal(Parcel.java:4875)
at android.os.Parcel.readParcelableInternal(Parcel.java:4788)
at android.os.Parcel.readValue(Parcel.java:4554)
at android.os.Parcel.readValue(Parcel.java:4334)
at android.os.Parcel.-$$Nest$mreadValue(Unknown Source)
at android.os.Parcel$LazyValue.apply(Parcel.java:4432)
at android.os.Parcel$LazyValue.apply(Parcel.java:4391)
at android.os.BaseBundle.getValueAt(BaseBundle.java:394)
at android.os.BaseBundle.getValue(BaseBundle.java:374)
at android.os.BaseBundle.getValue(BaseBundle.java:357)
at android.os.BaseBundle.get(BaseBundle.java:696)
at android.os.Bundle.getParcelable(Bundle.java:947)
at android.content.Intent.getParcelableExtra(Intent.java:8930)
at io.getstream.chat.android.compose.ui.attachments.preview.MediaGalleryPreviewActivity.onCreate$lambda$13(MediaGalleryPreviewActivity.kt)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.kt:122)
...
The private helper Intent.getParcelable<T>(key) in MediaGalleryPreviewActivity switches to the typed getParcelableExtra(key, T::class.java) from Build.VERSION_CODES.TIRAMISU. The typed Intent/Bundle getters have a known platform bug on API 33 that throws exactly this NPE inside Parcel.readParcelableCreatorInternal; it is fixed in API 34. That is why androidx.core.content.IntentCompat.getParcelableExtra / BundleCompat.getParcelable only use the typed API from UPSIDE_DOWN_CAKE and fall back to the untyped call on 33.
Suggested fix: replace the helper with IntentCompat.getParcelableExtra(intent, key, T::class.java) (or raise the version check to Build.VERSION_CODES.UPSIDE_DOWN_CAKE). The same pattern applies to the Bundle reads from savedInstanceState.
The file is identical in 7.13.0, 7.18.0 and develop, so the crash is still present in the latest release.
SDK version
stream-chat-android-compose7.13.0 (code unchanged up to 7.18.0 /develop)
To Reproduce
Not reproducible on demand: it is a platform race in the Android 13 typed Parcel API. Observed in production:
- Open a channel containing an image attachment
- Tap the image to open
MediaGalleryPreviewActivity - The activity crashes during the first composition
Expected behavior
The media gallery preview opens without crashing on Android 13.
Device:
- Vendor and model: Xiaomi Redmi Note 11 (2201117TY)
- Android version: 13 (TKQ1.221114.001)
Screenshots
N/A
- Dominant language
- Kotlin
- Stars
- 1.7k
- Forks
- 321
- Avg merge
- 19h 57m
- Merged PRs (30d)
- 167
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from GetStream/stream-chat-android
-
feature request
Difficulty 3/5 1-2 days Newbie friendliness 65/100
GetStream/stream-chat-android#6556 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
Add Sort Order Support for Media and Files Attachments Lists in Channel InfoMay be free again A pull request for this issue was closed without being merged. Openfeature request
Difficulty 4/5 3-5 days Newbie friendliness 55/100
GetStream/stream-chat-android#6359 ·
Maintainers usually reply within 1 day
-
feature request
Difficulty 3/5 1-2 days Newbie friendliness 38/100
GetStream/stream-chat-android#6243 ·
Maintainers usually reply within 1 day
-
Unable to wrap ChannelList height due to internal LazyColumn .fillMaxSize()May be free again @Ahmetkaragunlu claimed this 19 days ago, and no pull request is open. Opencompose feature request
Difficulty 4/5 3-5 days Newbie friendliness 35/100
GetStream/stream-chat-android#5612 · 4 comments ·
Maintainers usually reply within 1 day
-
core feature request
Difficulty 4/5 3-5 days Newbie friendliness 25/100
GetStream/stream-chat-android#5279 ·
Maintainers usually reply within 1 day
All issues in GetStream/stream-chat-android
Similar issues
-
unconfirmed
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
thunderbird/thunderbird-android#11893 · 1 comment ·
Maintainers usually reply within 2 days
-
Difficulty 1/5 Under an hour Newbie friendliness 65/100
Droid-Deck/DroidDeck#2198 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
world-federation-of-advertisers/cross-media-measurement#4846 ·
Maintainers usually reply within 1 day
-
autoteam community connectors/destination/mssql connectors/source/hubspot team/use
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
airbytehq/airbyte#91201 · 1 comment ·
Maintainers usually reply within 1 day
-
bug javascript
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day