tauri icon indicating copy to clipboard operation
tauri copied to clipboard

[bug] build android failed on windows11

Open cleveng opened this issue 3 months ago • 14 comments

Describe the bug

can build app of x86_64-pc-windows-msvc .

But cann't build android app.

Those code does not work when compiling Android in this project

$ cat ~/.cargo/config.toml
# [source.crates-io]
# replace-with = 'mirror'

# [source.mirror]
# registry = "https://mirrors.tuna.tsinghua.edu.cn/git/crates.io-index.git"

# [target.aarch64-linux-android]
# linker = "C:\\Users\\Administrator\\AppData\\Local\\Android\\Sdk\\ndk\\28.0.12433566\\toolchains\\llvm\\prebuilt\\windows-x86_64\\bin\\aarch64-linux-android35-clang"

by the way, no linker aarch64-linux-android-clang

Reproduction

No response

Expected behavior

`Failed to run `cargo build`: command ["cargo", "build", "--package", "vending-app", "--manifest-path", "C:\\Users\\Administrator\\code\\rust\\tauri-app\\src-tauri\\Cargo.toml", "--target", "i686-linux-android", "--features", "tauri/custom-protocol tauri/rustls-tls tauri/custom-protocol tauri/rustls-tls", "--lib"] exited with code -1073741819
    Error [tauri_cli_node] `Failed to run `cargo build`: command ["cargo", "build", "--package", "vending-app", "--manifest-path", "C:\\Users\\Administrator\\code\\rust\\tauri-app\\src-tauri\\Cargo.toml", "--target", "i686-linux-android", "--features", "tauri/custom-protocol tauri/rustls-tls tauri/custom-protocol tauri/rustls-tls", "--lib"] exited with code -1073741819
error: script "tauri" exited with code 1
Starting process 'command 'bun.cmd''. Working directory: C:\Users\Administrator\code\rust\tauri-app\src-tauri Command: bun.cmd tauri android android-studio-script -v --target i686

> Task :app:rustBuildX86Debug FAILED
Could not execute [report metric STATISTICS_COLLECT_METRICS_OVERHEAD]
Could not execute [report metric STATISTICS_COLLECT_METRICS_OVERHEAD]
AAPT2 aapt2-8.5.1-11315950-windows Daemon #0: shutdown

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:rustBuildX86Debug'.
> A problem occurred starting process 'command 'bun.cmd''

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 35s
197 actionable tasks: 16 executed, 181 up-to-date
Watched directory hierarchies: [C:\Users\Administrator\code\rust\tauri-app\src-tauri\gen\android]
Failed to build AAB: command ["C:\\Users\\Administrator\\code\\rust\\tauri-app\\src-tauri\\gen/android\\gradlew.bat", "--project-dir", "C:\\Users\\Administrator\\code\\rust\\tauri-app\\src-tauri\\gen/android"] exited with code 1: command ["C:\\Users\\Administrator\\code\\rust\\tauri-app\\src-tauri\\gen/android\\gradlew.bat", "--project-dir", "C:\\Users\\Administrator\\code\\rust\\tauri-app\\src-tauri\\gen/android"] exited with code 1
    Error [tauri_cli_node] Failed to build AAB: command ["C:\\Users\\Administrator\\code\\rust\\tauri-app\\src-tauri\\gen/android\\gradlew.bat", "--project-dir", "C:\\Users\\Administrator\\code\\rust\\tauri-app\\src-tauri\\gen/android"] exited with code 1: command ["C:\\Users\\Administrator\\code\\rust\\tauri-app\\src-tauri\\gen/android\\gradlew.bat", "--project-dir", "C:\\Users\\Administrator\\code\\rust\\tauri-app\\src-tauri\\gen/android"] exited with code 1
error: script "tauri" exited with code 1

tauri.config.json

{
  "$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
  "productName": "xxxx xxx App",
  "version": "1.1.0",
  "identifier": "com.xxx.xxx.app",
  "build": {
    "beforeDevCommand": "bun run dev",
    "devUrl": "http://localhost:5173",
    "beforeBuildCommand": "bun run build",
    "frontendDist": "../dist"
  },
  "app": {
    "windows": [
      {
        "fullscreen": false,
        "resizable": true,
        "title": "xxx xxx App",
        "width": 800,
        "height": 1280,
        "label": "main",
        "visible": true
      }
    ],
    "security": {
      "csp": null
    }
  },
  "bundle": {
    "active": true,
    "targets": "all",
    "icon": [
      "icons/32x32.png",
      "icons/128x128.png",
      "icons/[email protected]",
      "icons/icon.icns",
      "icons/icon.ico"
    ],
    "externalBin": [],
    "android": {
      "minSdkVersion": 24
    },
    "resources": [
      "resources/**/*"
    ],
    "publisher": "xxx Metal Products., LTD"
  },
  "plugins": {
    "board": {
      "protocol": "",
      "broker": "",
      "port": 1683,
      "username": "",
      "password": "",
      "merchant_id": "",
      "app_key": ""
    }
  }
}

Full tauri info output

[✔] Environment
    - OS: Windows 10.0.22631 x86_64 (X64)
    ✔ WebView2: 130.0.2849.56
    ✔ MSVC:
        - Visual Studio Community 2022
        - Visual Studio 生成工具 2022
    ✔ rustc: 1.82.0 (f6e511eec 2024-10-15)
    ✔ cargo: 1.82.0 (8f40fc59f 2024-08-21)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: stable-x86_64-pc-windows-msvc (environment override by RUSTUP_TOOLCHAIN)
    - node: 22.10.0
    - yarn: 1.22.22
    - npm: 10.9.0
    - bun: 1.1.33

[-] Packages
    - tauri 🦀: 2.0.6
    - tauri-build 🦀: 2.0.2
    - wry 🦀: 0.46.3
    - tao 🦀: 0.30.5
    - tauri-cli 🦀: 2.0.4
    - @tauri-apps/api : 2.0.3
    - @tauri-apps/cli : 2.0.5

[-] Plugins
    - tauri-plugin-shell 🦀: 2.0.0
    - @tauri-apps/plugin-shell : 2.0.1
    - tauri-plugin-process 🦀: 2.0.1
    - @tauri-apps/plugin-process : 2.0.0
    - tauri-plugin-dialog 🦀: 2.0.3
    - @tauri-apps/plugin-dialog : 2.0.1
    - tauri-plugin-autostart 🦀: 2.0.1
    - @tauri-apps/plugin-autostart : 2.0.0
    - tauri-plugin-barcode-scanner 🦀: 2.0.1
    - @tauri-apps/plugin-barcode-scanner : not installed!
    - tauri-plugin-os 🦀: 2.0.1
    - @tauri-apps/plugin-os : 2.0.0
    - tauri-plugin-fs 🦀: 2.0.3
    - @tauri-apps/plugin-fs : 2.0.1
    - tauri-plugin-log 🦀: 2.0.1
    - @tauri-apps/plugin-log : 2.0.0
    - tauri-plugin-store 🦀: 2.1.0
    - @tauri-apps/plugin-store : 2.1.0
    - tauri-plugin-cli 🦀: 2.0.1
    - @tauri-apps/plugin-cli : 2.0.0
    - tauri-plugin-nfc 🦀: 2.0.1
    - @tauri-apps/plugin-nfc : 2.0.0
    - tauri-plugin-notification 🦀: 2.0.1
    - @tauri-apps/plugin-notification : 2.0.0
    - tauri-plugin-websocket 🦀: 2.0.1
    - @tauri-apps/plugin-websocket : not installed!
    - tauri-plugin-http 🦀: 2.0.3
    - @tauri-apps/plugin-http : 2.0.1

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

Stack trace

No response

Additional context

I can compile successfully in debian gun env

cleveng avatar Oct 30 '24 09:10 cleveng