Skip to content

fix(emoji): enable androidResources for core:ui to package emoji-data.json#5597

Merged
jamesarich merged 1 commit into
mainfrom
jamesarich/ubiquitous-funicular
May 25, 2026
Merged

fix(emoji): enable androidResources for core:ui to package emoji-data.json#5597
jamesarich merged 1 commit into
mainfrom
jamesarich/ubiquitous-funicular

Conversation

@jamesarich

Copy link
Copy Markdown
Collaborator

Summary

Build 2320900 crashes with MissingResourceException when opening the emoji picker because emoji-data.json is not packaged into the APK's assets.

Root Cause

The convention plugin (KotlinAndroid.kt) defaults all KMP library modules to androidResources.enable = false. Without Android resources enabled, Compose Multiplatform files/ resources -- which rely on AGP's asset pipeline -- are silently excluded from the AAR and never make it into the final APK.

The core:resources module works because it explicitly overrides this to true. The core:ui module (which hosts the emoji picker and its emoji-data.json) did not, so Res.readBytes("files/emoji-data.json") throws at runtime.

Changes

  • core/ui/build.gradle.kts -- Enable androidResources so CMP file resources flow through the asset pipeline into the APK.
  • EmojiPickerViewModel -- Wrap preload() in a try/catch for MissingResourceException and IllegalStateException so future resource failures degrade gracefully (error state in UI) instead of crashing the app.
  • EmojiPickerDialog -- Render an error placeholder when loadError is true.

Testing

  • ./gradlew :core:ui:compileKotlinJvm -- passes
  • ./gradlew :core:ui:allTests -- passes
  • ./gradlew :core:ui:detekt -- passes
  • ./gradlew :core:ui:spotlessCheck -- passes

….json

The EmojiPickerDialog crashes with MissingResourceException on build
2320900 because emoji-data.json is not packaged into the APK assets.

Root cause: The convention plugin sets androidResources.enable = false
for all KMP library modules by default. Without it, CMP files/ resources
accessed via Res.readBytes() are not included in the Android AAR asset
pipeline — they simply don't make it into the final APK.

Fix: Enable androidResources for core:ui (matching core:resources which
already has this set). Also add defensive error handling so a resource
loading failure shows an error state instead of crashing the app.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot added the bugfix PR tag label May 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📄 Docs staleness check — advisory

This PR modifies user-facing UI source files but does not update any page under docs/en/user/ or docs/en/developer/.

⚠️ Doc changes propagate to 3 consumers: in-app docs browser, Jekyll site (GitHub Pages), and meshtastic.org (Docusaurus sync). Updating a page in docs/en/ automatically flows to all three.

Changed source files:

core/ui/src/commonMain/kotlin/org/meshtastic/core/ui/component/NodeItem.kt
core/ui/src/commonMain/kotlin/org/meshtastic/core/ui/component/NodeItemCompact.kt
core/ui/src/commonMain/kotlin/org/meshtastic/core/ui/emoji/EmojiPickerDialog.kt
core/ui/src/commonMain/kotlin/org/meshtastic/core/ui/emoji/EmojiPickerViewModel.kt

What to check:

Changed area Likely doc page
feature/messaging/ docs/en/user/messages-and-channels.md
feature/node/ docs/en/user/nodes.md or docs/en/user/node-metrics.md
feature/map/ docs/en/user/map-and-waypoints.md
feature/connections/ docs/en/user/connections.md
feature/settings/ docs/en/user/settings-radio-user.md or docs/en/user/settings-module-admin.md
feature/firmware/ docs/en/user/firmware.md
feature/intro/ docs/en/user/onboarding.md
feature/discovery/ docs/en/user/discovery.md
feature/docs/ Internal docs infrastructure
core/ui/ docs/en/developer/codebase.md or component-specific user pages

New page checklist (if adding a new doc page):

  1. Create the .md file in docs/en/user/ or docs/en/developer/ with last_updated frontmatter
  2. Register in DocBundleLoader.kt with string resources (in-app browser)
  3. Jekyll and Docusaurus sync pick up new pages automatically — no config change needed

If this PR does not require a doc update (e.g., internal refactor, bug fix, test change), add the skip-docs-check label to dismiss this check.

Cross-platform note: This check is advisory while doc coverage matures. Both Android and Apple repos use the same skip-docs-check label and advisory severity. See meshtastic/design standards for shared conventions.

@jamesarich jamesarich marked this pull request as ready for review May 25, 2026 20:30
@jamesarich jamesarich added this pull request to the merge queue May 25, 2026
Merged via the queue into main with commit f17c38b May 25, 2026
18 checks passed
@jamesarich jamesarich deleted the jamesarich/ubiquitous-funicular branch May 25, 2026 20:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix PR tag

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant