-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[bug] Direct Plugin calls from rust result in crashes in android #13063
Comments
Can you try making that call in an async context (or in another thread)? It may also help to upgrade tauri idk We use this approach in a few of our official plugins as well without issues so if the above doesn't help i'm afraid we'll need a full (minimal) reproduction repo to look at. |
Here's a full example https://github.com/F8RZD/tauri-kotlin-problem/tree/main/tauri-plugin-kt-runtime. Failing code: // This is working code but requires frontend to execute so is not suitable for my example
// let _ = handle.emit("sms-relay", sms_payload.clone());
// This code crashes the app
let _ = handle.kt_runtime().send_sms(sms_payload.clone()); The plugin is meant to provide background SMS forwarding capabilities |
The code triggers when a new SMS is received on emulator |
I completely missed the point about trying async context. it fixed the crashing issue. |
There still remains a major issue with using tauri for background applications. If the app is closed from recent apps inside avd this line of code freezes the app. let res = self.0.run_mobile_plugin::<()>("send_sms", payload); It stays frozen until the app is reopened and all calls fail at the same time with this error message:
Somehow this freezing is not affecting the async-runtime of tauri. maybe I'm just wrong assuming it's freezing but this long awaiting call that is most likely to fail makes the development cycle much more cumbersome. e.g. I now have to use a mutex to determine if the task X is ran or it just timed out and will fail in future when the app opens. |
Describe the bug
Calling plugins from rust backend crashes the app in android
sample:
All I see in logs is
And the
App isn't working
pop up in my emulator.The same code works fine in desktop and also works fine if I call it from frontend instead of rust.
Reproduction
No response
Expected behavior
No response
Full
tauri info
outputStack trace
Additional context
No response
The text was updated successfully, but these errors were encountered: