Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[bug] Android dev fail in Windows #6502

@meowtec

Description

@meowtec

Describe the bug

tauri android dev throw an error:

error Command failed with exit code 4294967295.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
       Error Failed to assemble APK: command ["D:\\workspace\\rust\\tauri\\examples\\api\\src-tauri/gen/android\\api\\gradlew.bat", "--stacktrace", "--project-dir", "D:\\workspace\\rust\\tauri\\examples\\api\\src-tauri/gen/android\\api"] exited with code 1
error Command failed with exit code 1.

Gradle output:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:rustBuildX86_64Debug'.
> A problem occurred starting process 'command 'yarn''

...

Caused by: java.io.IOException: Cannot run program "yarn" (in directory "D:\workspace\rust\tauri\examples\api\src-tauri"): CreateProcess error=2, 系统找不到指定的文件 (translated: 'The system cannot find the file specified')。
        at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:25)
        ... 7 more
Caused by: java.io.IOException: CreateProcess error=2, 系统找不到指定的文件 (translated: 'The system cannot find the file specified')。

It means that the gradle process can not find the npm or yarn command, but why?

This did not happen in @tauri-apps/[email protected]

Reproduction

  1. Development in Windows with Node installed.
  2. Clone tauri repo and checkout next branch.
  3. Build CLI + API.
  4. Run yarn tauri android init + yarn tauri android dev at examples/api.

Expected behavior

Android apk should be compiled successfully.

Platform and versions

Environment
  › OS: Windows 10.0.22624 X64
  › Webview2: 111.0.1661.44
  › MSVC: 
      - Visual Studio Community 2022
  › Node.js: 16.19.1
  › npm: 8.19.3
  › pnpm: 7.29.0
  › yarn: 1.22.19
  › rustup: 1.25.2
  › rustc: 1.67.1
  › cargo: 1.67.1
  › Rust toolchain: stable-x86_64-pc-windows-msvc 

Packages
  › @tauri-apps/cli [NPM]: 2.0.0-alpha.3
  › @tauri-apps/api [NPM]: 2.0.0-alpha.1
  › tauri [RUST]: 2.0.0-alpha.4,
  › tauri-build [RUST]: 2.0.0-alpha.2,
  › tao [RUST]: 0.18.0,
  › wry [RUST]: 0.27.0,

App
  › build-type: bundle
  › CSP: style-src 'unsafe-inline' 'self' https://fonts.googleapis.com; default-src 'self' customprotocol: asset:; font-src https://fonts.gstatic.com; img-src 'self' asset: https://asset.localhost blob: data:
  › distDir: ../dist
  › devPath: http://localhost:5173/
  › framework: Svelte
  › bundler: Vite

App directory structure
  ├─ dist
  ├─ isolation-dist
  ├─ node_modules
  ├─ public
  ├─ src
  └─ src-tauri

Stack trace

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions