tauri-apps / tauri

Build smaller, faster, and more secure desktop applications with a web frontend.
https://tauri.app
Apache License 2.0
82.37k stars 2.47k forks source link

[bug] V2 pnpm tauri android dev just hands and does nothing - Ubuntu 24.4.0 #11108

Open Xenoha opened 6 days ago

Xenoha commented 6 days ago

Describe the bug

pnpm Tauri android dev just hangs with no output or action. --verbose doesn't assist.

Reproduction

pnpm create tauri-app --rc cd tauri-app pnpm i pnpm tauri android init pnpm tauri dev -- builds and launches pnpm tauri android dev: hangs pnpm tauri android dev --open: opens android studio and will run the app after I open the emulator

Expected behavior

I would expect something to start compiling and then for the emulator to launch

Full tauri info output

[✔] Environment
    - OS: Ubuntu 24.4.0 x86_64 (X64)
    ✔ webkit2gtk-4.1: 2.44.3
    ✔ rsvg2: 2.58.0
    ✔ rustc: 1.81.0 (eeb90cda1 2024-09-04)
    ✔ cargo: 1.81.0 (2dbb1af80 2024-08-20)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: stable-x86_64-unknown-linux-gnu (default)
    - node: 22.8.0
    - pnpm: 9.11.0
    - npm: 10.8.2

[-] Packages
    - tauri 🦀: 2.0.0-rc.15
    - tauri-build 🦀: 2.0.0-rc.12
    - wry 🦀: 0.43.1
    - tao 🦀: 0.30.2
    - @tauri-apps/api : 2.0.0-rc.5
    - @tauri-apps/cli : 2.0.0-rc.16

[-] Plugins
    - tauri-plugin-shell 🦀: 2.0.0-rc.3
    - @tauri-apps/plugin-shell : 2.0.0-rc.1

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

Stack trace

No response

Additional context

.zshrc exports export JAVA_HOME=/snap/android-studio/current/jbr export ANDROID_HOME="$HOME/Android/Sdk" export NDK_HOME="$ANDROID_HOME/ndk/$(ls -1 $ANDROID_HOME/ndk)"

Android studio: CompileCommand: exclude com/intellij/openapi/vfs/impl/FilePartNodeRoot.trieDescend bool exclude = true Android Studio Koala | 2024.1.1 Build #AI-241.15989.150.2411.11948838

Note that 'pnpm tauri android dev --open' starts compiling and then opens android studio.

philipnguyxn commented 5 days ago

Confirm for both bun run tauri android dev and npm run tauri android dev. It only works with cargo tauri android dev. My hinge would be that PackageManager::from_project in npm.rs file was not called in tauri-cli/src/mobile/android/dev.rs file.

But I just cloned down the repo so not really surprise if this call is extracted out somewhere else.

cargo tauri info output

[✔] Environment
    - OS: Ubuntu 24.4.0 x86_64 (X64)
    ✔ webkit2gtk-4.1: 2.44.3
    ✔ rsvg2: 2.58.0
    ✔ rustc: 1.81.0 (eeb90cda1 2024-09-04)
    ✔ cargo: 1.81.0 (2dbb1af80 2024-08-20)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: stable-x86_64-unknown-linux-gnu (environment override by RUSTUP_TOOLCHAIN)
    - node: 20.11.1
    - npm: 10.8.2
    - bun: 1.0.33

[-] Packages
    - tauri 🦀: 2.0.0-rc.15
    - tauri-build 🦀: 2.0.0-rc.12
    - wry 🦀: 0.43.1
    - tao 🦀: 0.30.2
    - tauri-cli 🦀: 2.0.0-rc.16
    - @tauri-apps/api : 2.0.0-rc.5
    - @tauri-apps/cli : 2.0.0-rc.16

[-] Plugins
    - tauri-plugin-shell 🦀: 2.0.0-rc.3
    - @tauri-apps/plugin-shell : 2.0.0-rc.1

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../build
    - devUrl: http://localhost:1420/
    - framework: Svelte
    - bundler: Vite
Xenoha commented 5 days ago

Just an update. I tried to install the tauri-cli in cargo and it failed to compile with the below errors. This might help you understand further what is going on.

Compiling java-properties v2.0.0 Compiling which v6.0.3 Compiling jsonrpsee-server v0.24.4 error[E0432]: unresolved import tower::util --> /home/xenoha/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jsonrpsee-server-0.24.4/src/utils.rs:37:12 37 use tower::util::Oneshot; ^^^^ could not find util in tower
note: found an item that was configured out --> /home/xenoha/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tower-0.4.13/src/lib.rs:215:9 215 pub mod util; ^^^^ note: the item is gated behind the util feature --> /home/xenoha/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tower-0.4.13/src/lib.rs:213:7
213 #[cfg(feature = "util")]
^^^^^^^^^^^^^^^^
error[E0432]: unresolved import tower::ServiceExt --> /home/xenoha/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jsonrpsee-server-0.24.4/src/utils.rs:38:5 38 use tower::ServiceExt; ^^^^^^^----------
help: a similar name exists in the module: Service
no ServiceExt in the root
note: found an item that was configured out --> /home/xenoha/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tower-0.4.13/src/lib.rs:223:34 223 pub use self::util::{service_fn, ServiceExt}; ^^^^^^^^^^ note: the item is gated behind the util feature --> /home/xenoha/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tower-0.4.13/src/lib.rs:220:7
220 #[cfg(feature = "util")]
^^^^^^^^^^^^^^^^
Compiling notify v6.1.1 error[E0599]: the method graceful_shutdown exists for struct Pin<&mut UpgradeableConnection<'_, ..., ..., ...>>, but its trait bounds were not satisfied --> /home/xenoha/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jsonrpsee-server-0.24.4/src/server.rs:1233:19 1233 conn.as_mut().graceful_shutdown(); ^^^^^^^^^^^^^^^^^ method cannot be called on Pin<&mut UpgradeableConnection<'_, ..., ..., ...>> due to unsatisfied trait bounds
::: /home/xenoha/.cargo/registry/src/index.crates.io-6f17d22bba15001f/hyper-util-0.1.9/src/rt/tokio.rs:16:1
 |
16 pub struct TokioExecutor {} ------------------------ doesn't satisfy _: HttpServerConnExec<TowerToHyperServiceFuture<<HttpMiddleware as Layer<TowerServiceNoHttp<RpcMiddleware>>>::Service, Request<Body>>, Body>
 = note: the full type name has been written to '/tmp/cargo-installlrudBG/release/deps/jsonrpsee_server-d2a922bd19a60316.long-type-8540593724089480555.txt'
 = note: consider using `--verbose` to print the full type name to the console
 = note: the following trait bounds were not satisfied:
         `{type error}: Sized`
         which is required by `TokioExecutor: HttpServerConnExec<utils::TowerToHyperServiceFuture<<HttpMiddleware as Layer<TowerServiceNoHttp<RpcMiddleware>>>::Service, hyper::Request<jsonrpsee_core::http_helpers::Body>>, Body>`

error[E0599]: no method named oneshot found for type parameter S in the current scope --> /home/xenoha/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jsonrpsee-server-0.24.4/src/utils.rs:61:60 | 51 | impl hyper::service::Service<HttpRequest> for TowerToH... | - method oneshot not found for this type parameter ... 61 | TowerToHyperServiceFuture { future: self.service.clone().oneshot(req) } | ^^^^^^^ method not found in S

Some errors have detailed explanations: E0432, E0599. For more information about an error, try rustc --explain E0432. error: could not compile jsonrpsee-server (lib) due to 4 previous errors warning: build failed, waiting for other jobs to finish... error: failed to compile tauri-cli v2.0.0-rc.16, intermediate artifacts can be found at /tmp/cargo-installlrudBG. To reuse those artifacts with a future compilation, set the environment variable CARGO_TARGET_DIR to that path.

philipnguyxn commented 5 days ago

Confirm that they are two different errors. And actually this one has a huge impact on the installation of tauri-cli crate, at least in the last 3 versions that I tried (rc.13 -> rc.16). From the error messages, this is likely coming from tower crate that are being used in the jsonrpsee-server crate. Surprisingly that I haven't seen any issues from both repo about the above errors.

Can @FabianLars double check about this and correct me if I'm wrong pls?

FabianLars commented 4 days ago

To install the cli you currently need to use the --locked flag

cargo install tauri-cli --version "^2.0.0-rc" --locked

On first glance I don't see why this started to happen ~yesterday - got one or two reports on discord as well. I don't think it's that important to figure out though as the --locked flag is always recommended for cargo install commands (if you saw commands without the flag in our docs, please tell me, i've been searching for it earlier today after seeing that nobody uses it)

Edit: Oh lol, it's in the setup instructions, i'll update that. If you see it anywhere else though, please reach out.

philipnguyxn commented 4 days ago

I didn't need to use this the first time I installed the rc version, weird. And also I use the cmd from the crates.io page, so it's good if that got updated as well.

FabianLars commented 4 days ago

I didn't need to use this the first time I installed the rc version, weird

Yeah, the issue should be that there were some dependency updates after that that weren't fully semver compliant. So back then the --locked flag wasn't needed but now it's required to make sure all the dependency versions match the ones in the lockfile == the versions when we released an update

And also I use the cmd from the crates.io page, so it's good if that got updated as well.

do you have a link? i don't see what you mean.

Xenoha commented 4 days ago

https://v2.tauri.app/start/create-project/

Is the link that describes the create project for V2. The only place it documents installing the tauri-cli is when you are doing manual install where it doesn't have the --locked flag. Does the cargo command for create-tauri-app install the cli? Will it need the locked flag?

FabianLars commented 4 days ago

v2.tauri.app/start/create-project

yeah i pushed an update shortly after i wrote the above comment but the build pipeline failed :/

Does the cargo command for create-tauri-app install the cli?

Only if you selected a npm/js frontend framework. It does not install the cargo cli. The npm cli does not need the locked flag