From dc1f516da7b4cde4742cbaa779ad1354e2b10324 Mon Sep 17 00:00:00 2001 From: Duncan Tourolle Date: Sat, 20 Jun 2026 18:36:57 +0200 Subject: [PATCH] Fix Android insta-crash: don't export TS bindings at runtime MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The tauri-specta `.export(...)` call ran inside run() on every debug app start and tried to write `../src/lib/api/bindings.ts`, a path that doesn't exist on a device — `.expect()` panicked at startup, crashing the app instantly on Android. Bindings are generated by the `export_typescript_bindings` test instead. --- src-tauri/src/lib.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 38a0ea4..0999fb3 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -586,14 +586,12 @@ pub fn run() { .filter_level(log::LevelFilter::Info) .init(); + // NOTE: TypeScript bindings are generated by the `export_typescript_bindings` + // test (`cargo test export_typescript_bindings`), NOT at runtime. Calling + // `.export()` here would try to write `../src/lib/api/bindings.ts` at app + // startup, which panics on devices (e.g. Android) where that path doesn't exist. let builder = specta_builder(); - // Export TypeScript bindings (types + typed invoke wrappers) in dev builds. - #[cfg(debug_assertions)] - builder - .export(specta_typescript::Typescript::default().bigint(specta_typescript::BigIntExportBehavior::Number), "../src/lib/api/bindings.ts") - .expect("Failed to export typescript bindings"); - tauri::Builder::default() .plugin(tauri_plugin_opener::init()) .plugin(tauri_plugin_os::init())