Build and package the app for Android from the same Tauri 2 codebase, shipping
an installable, sideloadable signed APK alongside the desktop binaries.
Build / packaging
- cfg-gate desktop-only tray / single-instance / hide-to-tray / exit-prevention
in lib.rs behind #[cfg(desktop)]; move tauri-plugin-single-instance to a
desktop-only target table so the library compiles for Android.
- `cargo tauri android init` -> committed gen/android Gradle project; release
signingConfigs read keystore.properties (gitignored, from CI secrets locally).
- .github/workflows/release-android.yml: JDK 17 + Android SDK/NDK + rust targets,
decode keystore from secrets, build --apk, upload to the same draft release.
- vite.config.ts: es2020 build.target for Tauri builds (older-WebView safety).
Runtime fixes (found via on-device testing)
- External links: a real tap on `<a target="_blank">` makes the Android WebView
fire onCreateWindow, which Tauri tries to satisfy via the shell plugin's open
(no such binary on Android -> uncaught error, nothing opens). Strip
target="_blank" from external anchors and route clicks through the opener
plugin in the capture phase. (open-external.ts, main.tsx)
- Boot black screen on old WebViews: crypto.randomUUID() (Chrome/WebView 92+)
ran at module load and threw on WebView 91. Fall back to a manual RFC 4122 v4
built on getRandomValues. (uuid.ts; +4 regression tests, 509 -> 513)
- File export on Android routes through the in-WebView blob download. (IS_MOBILE)
Compatibility
- minSdk 30 (Android 11+), targetSdk 36 (Android 16): covers the large majority
of active devices with a modern, patched WebView + Google Play system updates.
Release: bump manifests 0.28.0 -> 0.29.0; docs (README, FEATURES, PACKAGING,
CHANGELOG). Verified on an Android 13 emulator (render, links, export).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>