[bug] Android: custom plugin events never reach `addPluginListener` JS callbacks when tauri-codegen + tauri-macros are 2.6.x (works with 2.5.5)
Describe the bug
On Android, events emitted by a custom plugin never reach their JavaScript listeners.
Registration succeeds, the native side fires and delivers the event, but the JS callback
registered with addPluginListener is never invoked. No error is thrown.
This is a regression correlated with the tauri-codegen / tauri-macros version pair:
tauri-codegen / tauri-macros |
Result |
|---|---|
| 2.5.5 / 2.5.5 | ✅ JS listeners fire |
| 2.6.3 / 2.6.3 | ❌ JS listeners never fire |
The tauri crate stayed at 2.10.1 (and 2.10.3) throughout. The JS code, the plugin
revision, and the generated Android project were unchanged between the two runs.
Reproduction
Android Tauri v2 app,
tauripinned 2.10.1,tauri-build2.5.6.Custom Android plugin (
music-notification) that emits events from a nativeBroadcastReceiverwhen the Android media session's Next action is dispatched.In JS, register listeners on mount:
await Promise.all([ onPlay(...), onPause(...), onNext(...), onPrev(...), onPreviousAlbumNeeded(...), onQueueEnded(...), ]); // implemented as: core.addPluginListener("music-notification", "onNext", cb)Press Play, then trigger Next from the media notification (or call the plugin's
next()command directly — both reproduce).Switch the dependency pair and repeat:
cargo update -p tauri-codegen --precise 2.5.5 cargo update -p tauri-macros --precise 2.5.5 # listeners fire (fixed) cargo update -p tauri-codegen --precise 2.6.3 cargo update -p tauri-macros --precise 2.6.3 # listeners dead (broken)Note: with
tauri = "=2.10.1", a fresh resolve picks 2.6.3 for this pair automatically — notauriupgrade is needed to trigger the bug.
Plugin source: https://github.com/AverTry/tauri-plugin-music-notification
(revision 21ed5d7b42ea14832e09cdb204bcfbc957313937, consumed as a local path
dependency). The Kotlin service sends a local broadcast; the plugin's
BroadcastReceiver.onReceive receives it and triggers the event.
Expected behavior
With tauri-codegen/tauri-macros 2.6.3, the JS callback should fire exactly as it
does with 2.5.5. Native event emission is identical in both cases.
Full tauri info output
**Broken (codegen/macros 2.6.3)** — native emits, plugin receives, JS is silent:
D/MusicPlayerService: Sent broadcast: eventName=onNext, action=next, currentIndex=5, isPlaying=false, trackId=5
D/MusicNotificationPlugin: BroadcastReceiver.onReceive called with action: MUSIC_NOTIFICATION_EVENT
D/MusicNotificationPlugin: Event received: eventName=onNext, action=next, currentIndex=5, isPlaying=false, trackId=5
[AUDIO] >>> all 6 listeners registered // ← no "onNext FIRED" ever follows
**Working (codegen/macros 2.5.5)** — identical native side, and the JS callback runs:
D/MusicNotificationPlugin: Event received: eventName=onNext, action=next, currentIndex=5, isPlaying=true, trackId=5
[AUDIO] onNext FIRED [object Object]
[AUDIO] onNext -> handleAudioPageChange(1)
User-visible effect: the reader screen does not advance when Next is pressed.
Stack trace
No exception or Rust panic is produced. There is no ACL/permission error at event
delivery time. The only unusual console output is this, present in both working and
broken runs and believed unrelated to the regression:
Uncaught (in promise) notification.is_permission_granted not allowed on window "main",
webview "main", URL: about:blank
referenced by: capability: default / mobile-capability, permission: allow-is-permission-granted
Additional context
Exact dependency set (identical in both runs unless stated):
tauri = { version = "=2.10.1", features = ["protocol-asset"] }
tauri-build = { version = "=2.5.6", features = [] }
tauri-runtime = "=2.10.1"
tauri-runtime-wry = "=2.10.1"
Resolved, and identical in both the working and broken runs:
tauri 2.10.1
tauri-build 2.5.6
tauri-runtime 2.10.1
tauri-runtime-wry 2.10.1
tauri-utils 2.9.3
tauri-plugin 2.5.4
@tauri-apps/api ⟨version⟩
@tauri-apps/cli ⟨version⟩
The only variables between working and broken are tauri-codegen and tauri-macros
(2.5.5 → 2.6.3).
Other things already ruled out by testing:
tauricrate: 2.10.1 and 2.10.3 both reproduce.tauri2.11.x reproduces.tauri-utils: 2.8.3 and 2.9.3 both fine.tauri-plugin: stayed at 2.5.4 the whole time.- JavaScript side: untouched between runs.
tauri-runtime/tauri-runtime-wry: forced to 2.10.1 via direct exact dependencies, which does not fix it.- Not a lockdown/ACL error — registration is not rejected, the event is simply not delivered to the registered JS callback.
Environment:
- OS: Windows ⟨11pro⟩
- Target: Android
aarch64-linux-android - Device/OS: ⟨s10+l, 12⟩
- Dev vs release build: ⟨both⟩
- Frontend: SolidJS + Vite
Request: I've isolated this to the version pair but don't know the mechanism.
Given that tauri 2.10.x will pull tauri-codegen/tauri-macros 2.6.x on a fresh
resolve, it would be good to know whether that combination is intended to be
supported. Happy to test proposed fixes or cut a minimal reproduction repo.
Workaround for now: pin both to =2.5.5 and keep Cargo.lock committed.
Downloaded libredox v0.1.24
Downloaded toml_datetime v0.6.3
Downloaded wasm-streams v0.5.0
Downloaded x11-dl v2.21.0
Downloaded web-time v1.1.0
Downloaded wit-bindgen v0.57.1
Downloaded x11 v2.21.0
Downloaded wasm-bindgen-macro-support v0.2.128
Downloaded zerocopy-derive v0.8.57
Downloaded r-efi v5.3.0
Downloaded winnow v0.5.40
Downloaded toml_edit v0.20.2
Downloaded gdk v0.18.2
Downloaded objc2-core-text v0.3.2
Downloaded objc2-web-kit v0.3.2
Downloaded wasip2 v1.0.4+wasi-0.2.12
Downloaded objc2-core-foundation v0.3.2
Downloaded portable-atomic v1.15.0
Downloaded gio v0.18.4
Downloaded glib v0.18.5
Downloaded gtk-sys v0.18.2
Downloaded js-sys v0.3.105
Downloaded objc2 v0.6.4
Downloaded bumpalo v3.20.3
Downloaded windows_x86_64_gnullvm v0.42.2
Downloaded objc2-foundation v0.3.2
Downloaded nix v0.31.3
Downloaded windows_aarch64_gnullvm v0.42.2
Downloaded windows_aarch64_gnullvm v0.48.5
Downloaded windows_x86_64_gnullvm v0.48.5
Downloaded windows_x86_64_gnullvm v0.52.6
Downloaded windows_aarch64_gnullvm v0.52.6
Downloaded gtk v0.18.2
Downloaded windows_i686_gnullvm v0.52.6
Downloaded toml_edit v0.19.15
Downloaded toml v0.8.2
Downloaded objc2-ui-kit v0.3.2
Downloaded objc2-app-kit v0.3.2
Downloaded objc2-core-image v0.3.2
Downloaded gio-sys v0.18.1
Downloaded r-efi v6.0.0
Downloaded glib-sys v0.18.1
Downloaded windows_aarch64_msvc v0.42.2
Downloaded web-sys v0.3.105
Downloaded windows_i686_msvc v0.42.2
Downloaded windows_x86_64_gnu v0.42.2
Downloaded windows_i686_gnu v0.42.2
Downloaded gdk-sys v0.18.2
Downloaded dispatch2 v0.3.1
Downloaded windows_x86_64_gnullvm v0.53.1
Downloaded windows_aarch64_msvc v0.48.5
Downloaded windows_x86_64_gnu v0.52.6
Downloaded windows_i686_gnullvm v0.53.1
Downloaded windows_i686_msvc v0.53.1
Downloaded windows_i686_gnu v0.52.6
Downloaded windows_x86_64_gnu v0.53.1
Downloaded windows_i686_msvc v0.52.6
Downloaded windows_i686_gnu v0.48.5
Downloaded windows_i686_gnu v0.53.1
Downloaded windows_aarch64_msvc v0.52.6
Downloaded windows_x86_64_gnu v0.48.5
Downloaded windows_i686_msvc v0.48.5
Downloaded windows_aarch64_msvc v0.53.1
Downloaded windows_aarch64_gnullvm v0.53.1
Downloaded base64 v0.21.7
Downloaded portable-atomic-util v0.2.8
Downloaded glib-macros v0.18.5
Downloaded cairo-rs v0.18.5
Downloaded soup3 v0.5.0
Downloaded redox_syscall v0.5.18
Downloaded winapi v0.3.9
Downloaded objc2-core-data v0.3.2
Downloaded libappindicator v0.9.0
Downloaded hermit-abi v0.5.3
Downloaded core-graphics v0.25.0
Downloaded core-foundation-sys v0.8.7
Downloaded pango v0.18.3
Downloaded objc2-quartz-core v0.3.2
Downloaded objc2-core-video v0.3.2
Downloaded gdkx11 v0.18.2
Downloaded gdk-pixbuf v0.18.5
Downloaded wasi v0.9.0+wasi-snapshot-preview1
Downloaded target-lexicon v0.12.16
Downloaded redox_syscall v0.9.4
Downloaded pango-sys v0.18.0
Downloaded javascriptcore-rs v1.1.2
Downloaded webkit2gtk v2.0.2
Downloaded wasm-bindgen v0.2.128
Downloaded valuable v0.1.1
Downloaded swift-rs v1.0.8
Downloaded soup3-sys v0.5.0
Downloaded proc-macro-error-attr v1.0.4
Downloaded proc-macro-error v1.0.4
Downloaded objc2-core-location v0.3.2
Downloaded mac-notification-sys v0.6.15
Downloaded libloading v0.7.4
Downloaded foreign-types-shared v0.3.1
Downloaded foreign-types v0.5.0
Downloaded embed_plist v1.2.2
Downloaded atk-sys v0.18.2
Downloaded wasm-bindgen-futures v0.4.78
Downloaded rand_hc v0.2.0
Downloaded jiff-static v0.2.37
Downloaded javascriptcore-rs-sys v1.1.1
Downloaded gtk3-macros v0.18.2
Downloaded webkit2gtk-sys v2.0.2
Downloaded wasm-bindgen-shared v0.2.128
Downloaded wasm-bindgen-macro v0.2.128
Downloaded wasite v0.1.0
Downloaded plain v0.2.3
Downloaded objc2-cloud-kit v0.3.2
Downloaded heck v0.4.1
Downloaded gdkwayland-sys v0.18.2
Downloaded foreign-types-macros v0.2.4
Downloaded field-offset v0.3.6
Downloaded dlopen2_derive v0.4.3
Downloaded dlopen2 v0.8.2
Downloaded cfg-expr v0.15.8
Downloaded wasm-streams v0.4.2
Downloaded wasi v0.11.1+wasi-snapshot-preview1
Downloaded version-compare v0.2.1
Downloaded system-deps v6.2.2
Downloaded serde_spanned v0.6.9
Downloaded redox_users v0.5.2
Downloaded proc-macro-crate v2.0.2
Downloaded proc-macro-crate v1.3.1
Downloaded objc2-user-notifications v0.3.2
Downloaded objc2-io-surface v0.3.2
Downloaded objc2-exception-helper v0.1.1
Downloaded libappindicator-sys v0.9.0
Downloaded gobject-sys v0.18.0
Downloaded core-foundation v0.10.1
Downloaded cairo-sys-rs v0.18.2
Downloaded objc2-encode v4.1.0
Downloaded objc2-core-graphics v0.3.2
Downloaded iana-time-zone-haiku v0.1.2
Downloaded gdkx11-sys v0.18.2
Downloaded gdk-pixbuf-sys v0.18.0
Downloaded block2 v0.6.2
Downloaded atk v0.18.2
Downloaded core-graphics-types v0.2.0
eof
Source: tauri-apps/tauri