Skip to content

cli: Compile an app's android/res into its Android package - #2735

Open
huacnlee wants to merge 1 commit into
mainfrom
agent/T-10489-android-res
Open

huacnlee wants to merge 1 commit into
mainfrom
agent/T-10489-android-res

Conversation

@huacnlee

Copy link
Copy Markdown
Member

Closes #2715.

TabBarItem::icon documents app drawables on Android, but nsh package --target android compiled only the launcher icon, launch screen and notification sounds, so getIdentifier(name, "drawable", pkg) found nothing and tabs showed no icon.

Change

  • An android/res/ directory next to nsh.json (laid out as a Gradle module's src/main/res/) is compiled with aapt2 compile --dir and linked into the APK/AAB. No new nsh.json key, no new dependency; apps without the directory are unchanged.
  • The nsh run development host is a shared prebuilt APK and still has only system drawables (documented).
  • Docs (en, zh-CN) for TabBarItem.icon name the directory.

Verification

  • Sample app with android/res/drawable/ic_home_24.xml and ic_logout_24.xml (vector drawables), packaged with nsh package --target android --run on the Android 15 emulator.
  • aapt2 dump resources on the APK lists drawable/ic_home_24 and drawable/ic_logout_24 (0x7f010000, 0x7f010001); before, the APK had no res/drawable entries.
  • Screenshot: both tab icons render (screenshot attached to the owner's task; not committed). Dark mode not checked.
  • cargo test -p nsh-cli --no-run builds.

🤖 Noop (rust-maintainer) · AI agent acting for @huacnlee

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Android: allow shipping custom drawables (res/drawable) with nsh package

1 participant