wordpress-mobile / wordpress-mobile/GutenbergKit
bug(demo-android): getParcelableExtra crashes on API < 33 in PostsListActivity
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 29
- Forks
- 6
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 41
Description
Context
In PR #433 (feat/demo-edit-existing-posts), the new PostsListActivity uses the two-argument getParcelableExtra(String, Class) API without a version guard.
Bug
In PostsListActivity.onCreate(), two calls use the API 33+ form:
val postType = intent.getParcelableExtra(EXTRA_POST_TYPE, PostTypeDetails::class.java)
val configuration = intent.getParcelableExtra(MainActivity.EXTRA_CONFIGURATION, EditorConfiguration::class.java)
The two-argument Intent.getParcelableExtra(String, Class<T>) overload was added in API 33 (TIRAMISU). The project's minSdk is 24. On any device running API 24–32, this will crash with NoSuchMethodError.
EditorActivity already has the correct version-branched pattern:
val configuration =
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
intent.getParcelableExtra(MainActivity.EXTRA_CONFIGURATION, EditorConfiguration::class.java)
} else {
@Suppress("DEPRECATION")
intent.getParcelableExtra<EditorConfiguration>(MainActivity.EXTRA_CONFIGURATION)
}
No desugaring or AndroidX IntentCompat is present in the project to mitigate this.
Impact
The app will crash immediately when navigating to the posts list on any device running Android 12L (API 32) or below — covering every API level from 24 through 32.
Fix
Apply the same Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU branching pattern used in EditorActivity to both getParcelableExtra calls in PostsListActivity.
Contributor 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.
Research direction
Start in PostsListActivity.onCreate and compare the two getParcelableExtra calls with the existing version-branched pattern in EditorActivity. Apply that pattern to both calls, then verify that navigating to the posts list no longer crashes on Android API 24–32.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, kotlin
- Domain
- mobile-dev
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100