tauri-apps / tauri

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

[bug] tauri android can't connect to tauri.localhost,dns error #8824

Open zinso opened 9 months ago

zinso commented 9 months ago

Describe the bug

After Android apk package is built and installed, the web page that displays: https://tauri.localhost error tying to connect :dns error;failed to lookup adress.

error sending request for url
(http://tauri.localhost/): error trying to connect: dns error: failed to lookup address information: No address associated with hostname

Reproduction

No response

Expected behavior

No response

Full tauri info output

[✔] Environment
    - OS: Mac OS 14.3.0 X64
    ✔ Xcode Command Line Tools: installed
    ✔ rustc: 1.75.0-nightly (9d83ac217 2023-10-31)
    ✔ cargo: 1.75.0-nightly (b4d18d4bd 2023-10-31)
    ✔ rustup: 1.26.0 (5af9b9484 2023-04-05)
    ✔ Rust toolchain: nightly-aarch64-apple-darwin (default)
    - node: 21.6.1
    - pnpm: 8.15.1
    - yarn: 1.22.21
    - npm: 10.2.4

[-] Packages
    - tauri [RUST]: 2.0.0-beta.2
    - tauri-build [RUST]: 2.0.0-beta.1
    - wry [RUST]: 0.35.2
    - tao [RUST]: 0.25.0
    - tauri-cli [RUST]: 2.0.0-alpha.17
    - @tauri-apps/api [NPM]: 2.0.0-beta.0
    - @tauri-apps/cli [NPM]: 2.0.0-beta.1

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ["../dist"]
    - framework: React
    - bundler: Vite

Stack trace

No response

Additional context

No response

Valeriooooh commented 7 months ago

have the same issue, when compiling with leptos is says something about failing to read metadata

tangramor commented 1 month ago

In my test env (Windows 10), I met the similar problem, and the problem was fixed by modifying vite.config.ts:

const host = '0.0.0.0';  //process.env.TAURI_DEV_HOST;