Make 'tauri android dev --open' find a Toolbox-installed Android Studio

cargo-mobile2 locates Studio by scanning XDG data dirs for a .desktop entry
whose Name is exactly "Android Studio", then runs its Exec line. A standalone
install writes that name; JetBrains Toolbox writes a versioned one ("Android
Studio Quail 2 2026.1.2 Patch 1"), so the lookup misses and it falls back to
running "Android Studio" as a literal command, failing with an ENOENT that
names every env var except the actual problem.

android-setup.sh now writes a hidden shim entry when no exact-name match
exists, reusing the Exec line Toolbox already generated rather than hardcoding
a path. Idempotent: a later run reports Studio as discoverable and rewrites
nothing.
This commit is contained in:
2026-08-02 13:27:24 -05:00
parent 17c927afa3
commit 683f13e6bc
2 changed files with 81 additions and 1 deletions

View File

@@ -178,6 +178,14 @@ build fails with `failed to read missing addr file`.
With the dev session running, Studio's device dropdown, Device Manager
(emulator), and debugger all work normally.
> **JetBrains Toolbox users:** `--open` finds Studio by scanning XDG data dirs
> for a `.desktop` entry whose `Name` is *exactly* `Android Studio`. Toolbox
> writes a versioned name instead (e.g. `Android Studio Quail 2 2026.1.2 Patch
> 1`), so the lookup misses and the launch fails with a confusing
> `Cmd(["Android Studio"]) ... No such file or directory`. `android-setup.sh`
> drops in a hidden shim entry (`~/.local/share/applications/android-studio.desktop`)
> to fix this; delete that file to undo it.
To build without Studio and without a dev server, use `cargo tauri android
build` — that path needs no addr file.