Unified Tauri 2 development knowledge base covering core patterns, desktop, and mobile. TRIGGER WHEN: working with Tauri commands, IPC, plugins, project setup, OAuth, CI/CD, window management, shell plugin, desktop bundling, platform WebViews, mobile environment setup, emulator/ADB, mobile plugins, IAP, and store deployment. DO NOT TRIGGER WHEN: the task is outside the specific scope of this component.
Cross-platform patterns for Tauri 2 applications -- core, desktop, and mobile.
| Task | Command |
|---|---|
| New project | npm create tauri-app@latest |
| Add plugin | npm run tauri add <plugin-name> |
| Dev mode | cargo tauri dev |
| Build | cargo tauri build |
| Info | cargo tauri info |
| Init Android | npm run tauri android init |
| Init iOS | npm run tauri ios init |
| Dev Android | npm run tauri android dev |
| Dev iOS | npm run tauri ios dev |
| Build APK |
npm run tauri android build --apk |
| Build AAB | npm run tauri android build --aab |
| Build iOS | npm run tauri ios build |
npm create tauri-app@latesttauri.conf.json with app identifiernpm run tauri android init / npm run tauri ios initadb logcat | grep -iE "(tauri|RustStdout)" for logsmy-app/
+-- src/ # Frontend (React/Vue/Svelte/etc.)
+-- src-tauri/
| +-- Cargo.toml
| +-- tauri.conf.json # Main config
| +-- src/
| | +-- main.rs # Desktop entry (don't modify)
| | +-- lib.rs # Main code + mobile entry
| +-- capabilities/
| | +-- default.json # Permissions
| +-- gen/
| +-- android/ # Android project (if mobile)
| +-- apple/ # Xcode project (if mobile)
{
"$schema": "https://schema.tauri.app/config/2",
"productName": "MyApp",
"identifier": "com.company.myapp",
"build": {
"devUrl": "http://localhost:5173",
"frontendDist": "../dist"
}
}
{
"identifier": "default",
"windows": ["main"],
"permissions": ["core:default"]
}
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
tauri::Builder::default()
.plugin(tauri_plugin_opener::init())
#[cfg(mobile)]
.plugin(tauri_plugin_biometric::init())
.invoke_handler(tauri::generate_handler![greet])
.run(tauri::generate_context!())
.expect("error");
}
| Problem | Solution |
|---|---|
| White screen | Check JS console, verify devUrl, check capabilities |
| Command not found | Verify handler registered in invoke_handler |
| Permission denied | Add permission to capabilities/default.json |
| Plugin not loaded | Check .plugin() call in lib.rs |
| iOS won't connect | Use --force-ip-prompt, select IPv6 |
| Emulator not detected | Verify adb devices, restart ADB |
| HMR not working | Configure vite.config.ts with TAURI_DEV_HOST |