tauri icon indicating copy to clipboard operation
tauri copied to clipboard

[bug] Android os error 2 with sidecar

Open lindongchen opened this issue 1 year ago • 7 comments

Describe the bug

Error: Uncaught (in promise) No such file or directory (os error 2) Event: Command.sidecar("bin/pipy", args) ...call sidecar Sidecar position: src-tauri/bin/pipy-aarch64-linux-android Sidecar package position: src-tauri/target/aarch64-linux-android/debug/pipy Sidecar bundle: tauri.conf.json => bundle > "externalBin": ["bin/pipy"]

Simply put, I saw that the sidecar had been packaged in a reasonable location, but when running on the Android emulator, I couldn't find the file. What I can confirm is that other programs can run as usual, and on Mac OS and Windows, my sidecar still works as usual, but it can't be found on the Android emulator

Here is my Cargo.toml configuration:

[lib]
name = "ztm_lib"
crate-type = ["lib", "cdylib", "staticlib"]

[build-dependencies]
tauri-build = { version = "2.0.0-beta", features = [] }

# tauri = { version = "2.0.0-beta", features = ["devtools"] }
[dependencies]
fix-path-env = { git = "https://github.com/tauri-apps/fix-path-env-rs" }
tauri = { version = "=2.0.0-beta.19", features = [] }
tauri-plugin-shell = "2.0.0-beta.4"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
tauri-plugin-process = "2.0.0-beta.3"
tauri-plugin-http = "2.0.0-beta.3"
tauri-plugin-os = "2.0.0-beta.3"
tauri-plugin-fs = "=2.0.0-beta.7"

[target."cfg(not(any(target_os = \"android\", target_os = \"ios\")))".dependencies]
tauri-plugin-cli = "2.0.0-beta"

[target.'cfg(any(target_os = "android"))']
linker = "~/Library/Android/sdk/ndk/27.0.11718014/toolchains/llvm/prebuilt/darwin-x86_64/bin"

Reproduction

No response

Expected behavior

No response

Full tauri info output

[✔] Environment
    - OS: Mac OS 12.0.1 X64
    ✔ Xcode Command Line Tools: installed
    ✔ rustc: 1.77.0 (aedd173a2 2024-03-17)
    ✔ cargo: 1.77.0 (3fe68eabf 2024-02-29)
    ✔ rustup: 1.27.0 (bbb9276d2 2024-03-08)
    ✔ Rust toolchain: stable-aarch64-apple-darwin (default)
    - node: 21.7.1
    - pnpm: 8.10.5
    - yarn: 1.22.17
    - npm: 6.14.17

[-] Packages
    - tauri [RUST]: 2.0.0-beta.19
    - tauri-build [RUST]: 2.0.0-beta.15
    - wry [RUST]: 0.39.5
    - tao [RUST]: 0.28.0
    - @tauri-apps/api [NPM]: 2.0.0-beta.11
    - @tauri-apps/cli [NPM]: 2.0.0-beta.17

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../../agent/gui
    - devUrl: http://localhost:1420/
    - framework: Vue.js
    - bundler: Vite

Stack trace

No response

Additional context

No response

lindongchen avatar May 14 '24 13:05 lindongchen

As far as i know, sidecars are simply not supported on mobile. I hope we can improve the errors somehow though 🤔

FabianLars avatar May 14 '24 13:05 FabianLars

Can I call it with a rust code snippet like this Command::new("./src-tauri/bin/pipy")

lindongchen avatar May 14 '24 14:05 lindongchen

I don't think the binary is even included in the apk/aab so no. In a general sense, the path must point to where the file is after installation, so no src-tauri mention.

FabianLars avatar May 14 '24 14:05 FabianLars

Thanks, I understand that. Will the upcoming version plan to fix this issue? Or you have any other suggestions

lindongchen avatar May 15 '24 03:05 lindongchen

It's not planned right now but it's not a definite "no, never" yet. Either way I doubt that it will be part of the initial 2.0 Release.

FabianLars avatar May 15 '24 09:05 FabianLars

b503b5f4-f541-46bd-a0ca-f6f2fe64ff99 When I manually copy the binary to **src-tauri/gen/android/app/src/main/assets**, it can be displayed in **Android Studio**, so can I try calling it using Command.sidecar or Command.create?

lindongchen avatar May 16 '24 03:05 lindongchen